Advertisement
PVS-StudioWarnings

PVS-Studio warning V501 for Asterisk

Nov 24th, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | None | 0 0
  1. void check_pval_item(pval *item, ....)
  2. {
  3.   ....
  4.   if (strcasecmp(item->u1.str,"GotoIf") == 0
  5.       || strcasecmp(item->u1.str,"GotoIfTime") == 0
  6.       || strcasecmp(item->u1.str,"while") == 0
  7.       || strcasecmp(item->u1.str,"endwhile") == 0           //<==
  8.       || strcasecmp(item->u1.str,"random") == 0
  9.       || strcasecmp(item->u1.str,"gosub") == 0
  10.       || strcasecmp(item->u1.str,"gosubif") == 0
  11.       || strcasecmp(item->u1.str,"continuewhile") == 0
  12.       || strcasecmp(item->u1.str,"endwhile") == 0           //<==
  13.       || strcasecmp(item->u1.str,"execif") == 0
  14.       || ....)
  15.   {....}
  16. }
  17.  
  18. This suspicious code was found in Asterisk project by PVS-Studio static code analyzer.
  19. Warning message is:
  20. V501 There are identical sub-expressions 'strcasecmp(item->u1.str, "endwhile") == 0' to the left and to the right of the '||' operator. pval.c 2513
  21.  
  22. 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
Advertisement