Skip to content

Conversation

@mizdebsk
Copy link
Member

Simplify control flow by merging two branches with identical bodies into a single condition. This removes redundancy and improves readability without changing behavior.

Simplify control flow by merging two branches with identical bodies
into a single condition.  This removes redundancy and improves
readability without changing behavior.
Copy link
Member

@mkoncek mkoncek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you want to deduplicate code, there is an even shorter way:

if (auto substr = content.substr(position, 2); substr == "\\\\" or substr == "\\\"")

If i remember correctly, this is valid in C++2a.

@mizdebsk
Copy link
Member Author

mizdebsk commented Jul 22, 2025

Sure, I can make it even more compact.

An alternative that not only fixes static analysis warnings, but also simplifies code logic is opened as #33.

@mkoncek mkoncek merged commit ac52483 into fedora-java:main Jul 23, 2025
1 check passed
@mizdebsk mizdebsk deleted the pr/28 branch July 23, 2025 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants