likle / cwalk

Path library for C/C++. Cross-Platform for Linux, FreeBSD, Windows and MacOS. Supports UNIX and Windows path styles on those platforms.
https://likle.github.io/cwalk/
MIT License
253 stars 40 forks source link

useless set of variable is_device_path #19

Closed AngeloFrangione closed 3 years ago

AngeloFrangione commented 3 years ago

Hi!

I'm using cwalk in my project and i use the clang static analyzer tool for scanning my code and it scans cwalk too. And he finds an useless set of a variable in the code since multiple commits.

../../../subprojects/cwalk/src/cwalk.c:471:3: warning: Value stored to 'is_device_path' is never read
  is_device_path = false;
  ^                ~~~~~

That means it is useless to define it to false in the present code. Because you set it to anything else before using it. Do you intend to use it in the future ? It's nice that it's the only problem found by this tool, usually there are a ton !

likle commented 3 years ago

Hi @AngeloFrangione ! Thanks for submitting this issue. This assignment statement was there to ensure initialization, but you are right - it is not required. I removed it in https://github.com/likle/cwalk/commit/ddb4388423ef55ed92cbd9ecac4194881fbeaa80 on the master branch. Please let me know if you encounter more issues!

AngeloFrangione commented 3 years ago

It should be fine now ! Thank you!