summaryrefslogtreecommitdiff
path: root/lib/checksrc.pl
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-12-25 21:41:14 +0100
committerDaniel Stenberg <daniel@haxx.se>2021-12-26 12:04:25 +0100
commitecbd1fa78dd5dd9a917424264fde259934ae4b59 (patch)
tree1d9ebeab1f083a8794aa646987561dcc438d70c5 /lib/checksrc.pl
parentb8ef4a845be8cc2b82f3fbfee23f88b376655c0e (diff)
downloadcurl-ecbd1fa78dd5dd9a917424264fde259934ae4b59.tar.gz
checksrc: detect more kinds of NULL comparisons we avoidbagder/NULL-checks
Co-authored-by: Jay Satiro Closes #8180
Diffstat (limited to 'lib/checksrc.pl')
-rwxr-xr-xlib/checksrc.pl2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/checksrc.pl b/lib/checksrc.pl
index 8f98a99ab..eea1126d1 100755
--- a/lib/checksrc.pl
+++ b/lib/checksrc.pl
@@ -502,7 +502,7 @@ sub scanfile {
}
# check for '== NULL' in if/while conditions but not if the thing on
# the left of it is a function call
- if($nostr =~ /^(.*)(if|while)(\(.*[^)]) == NULL/) {
+ if($nostr =~ /^(.*)(if|while)(\(.*?)([!=]= NULL|NULL [!=]=)/) {
checkwarn("EQUALSNULL", $line,
length($1) + length($2) + length($3),
$file, $l, "we prefer !variable instead of \"== NULL\" comparisons");