Skip to content

fixed #13570 - PathMatch could no longer match a file after it tried to match a directory#7242

Merged
firewave merged 1 commit intocppcheck-opensource:mainfrom
firewave:pathmatch-x
Feb 7, 2025
Merged

fixed #13570 - PathMatch could no longer match a file after it tried to match a directory#7242
firewave merged 1 commit intocppcheck-opensource:mainfrom
firewave:pathmatch-x

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

No description provided.

@firewave
Copy link
Copy Markdown
Collaborator Author

This gave me a literal headache...and it seems I stumbled into even more bugs with -i...

Comment thread lib/pathmatch.cpp
if (!mCaseSensitive)
strTolower(findpath);
std::string finddir;
if (!endsWith(findpath,'/'))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The negation could be avoided by switching if/else.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I left the previous logic intact.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks like finddir could even be const if a ternary was used...

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I get the intention but it does not really makes things more readable. It would be great if findpath could also be const.

@firewave firewave merged commit f447521 into cppcheck-opensource:main Feb 7, 2025
@firewave firewave deleted the pathmatch-x branch February 7, 2025 22:01
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.

3 participants