PVS-StudioWarnings

PVS-Studio warning V501 for samba

Nov 17th, 2014
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. static int compare_procids(const void *p1, const void *p2)
  2. {
  3.   const struct server_id *i1 = (struct server_id *)p1;
  4.   const struct server_id *i2 = (struct server_id *)p2;
  5.  
  6.   if (i1->pid < i2->pid) return -1;
  7.   if (i2->pid > i2->pid) return 1;
  8.   return 0;
  9. }
  10.  
  11. This suspicious code was found in samba project by PVS-Studio static code analyzer.
  12. Warning message is:
  13. V501 There are identical sub-expressions to the left and to the right of the '>' operator: i2->pid > i2->pid brlock.c 1901
  14.  
  15. 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