diff options
author | Gerald Combs <gerald@wireshark.org> | 2020-07-07 11:35:05 -0700 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2020-07-08 01:56:18 +0000 |
commit | f0d456bf2d4d3ff7a344f7944b75e9b995227448 (patch) | |
tree | 620e6b02630343d5d2a176109080cf84fc38b5b5 /tools | |
parent | 1484c1e7f6df5a02ef15c9801ef5d1d13a8ae078 (diff) |
cppcheck: Fixup some comparisons.
Change-Id: I6901c31cdea7399bc18dbf968c14c477f71a90dd
Reviewed-on: https://code.wireshark.org/review/37777
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/cppcheck/cppcheck.sh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/cppcheck/cppcheck.sh b/tools/cppcheck/cppcheck.sh index 9730773acf..9bf95dc871 100755 --- a/tools/cppcheck/cppcheck.sh +++ b/tools/cppcheck/cppcheck.sh @@ -62,7 +62,7 @@ exit_cleanup() { if [ "$MODE" = "html" ]; then echo "</table></body></html>" fi - if [ -z "$1" ] ; then + if [ -n "$1" ] ; then exit "$1" fi } @@ -96,7 +96,7 @@ fi if [ "$LAST_COMMITS" -gt 0 ] ; then TARGET=$( git diff --name-only HEAD~"$LAST_COMMITS".. | grep -E '\.(c|cpp)$' ) - if [ -z "$TARGET" ] ; then + if [ -z "${TARGET//[[:space:]]/}" ] ; then echo "No C or C++ files found in the last $LAST_COMMITS commit(s)." exit_cleanup 0 fi @@ -105,7 +105,7 @@ fi if [ "$OPEN_FILES" = "yes" ] ; then TARGET=$(git diff --name-only | grep -E '\.(c|cpp)$' ) TARGET="$TARGET $(git diff --staged --name-only | grep -E '\.(c|cpp)$' )" - if [ -z "$TARGET" ] ; then + if [ -z "${TARGET//[[:space:]]/}" ] ; then echo "No C or C++ files are currently opened (modified or added for next commit)." exit_cleanup 0 fi |