Skip to content

Commit

Permalink
Fixed check in pairvalidate
Browse files Browse the repository at this point in the history
The only commit in this series that actually changes some behaviour. The test was supposed to check if one of the values (match and check) was false, while the other was true. Because the while loop already validated that at least one of them is true, we can get the desired behaviour by just checking if one of them is false. The old behaviour only tested to see if match was false.

This code is not tested in the unit tests. It would be nice to have it in there, but I've got no idea how to write that.

This fixes the following message of cppcheck:

[src/lib/valuepair.c:547]: (style) Same expression on both sides of '||'.
  • Loading branch information
herwinw committed Oct 17, 2014
1 parent 992c0e4 commit ed8d7b4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/valuepair.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ bool pairvalidate(VALUE_PAIR const *failed[2], VALUE_PAIR *filter, VALUE_PAIR *l
/*
* Lists are of different lengths
*/
if ((!match && check) || (check && !match)) goto mismatch;
if (!match || !check) goto mismatch;

/*
* The lists are sorted, so if the first
Expand Down

0 comments on commit ed8d7b4

Please sign in to comment.