PVS-StudioWarnings

PVS-Studio warning V814 for LibRaw

Nov 17th, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. char *my_strcasestr (char *haystack, const char *needle)
  2. {
  3.   char *c;
  4.   for (c = haystack; *c; c++)
  5.     if (!strncasecmp(c, needle, strlen(needle)))
  6.       return c;
  7.   return 0;
  8. }
  9.  
  10. This suspicious code was found in LibRaw project by PVS-Studio static code analyzer.
  11. Warning message is:
  12. V814 Decreased performance. The 'strlen' function was called multiple times inside the body of a loop. dcraw_common.cpp 72
  13.  
  14. PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment