diff options
author | Daniel Stenberg <daniel@haxx.se> | 2016-04-03 11:29:14 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2016-04-03 11:29:14 +0200 |
commit | 5ea3d2ff066dbb78fb6cdee5e07ee5ce1672f31a (patch) | |
tree | 053963f7a6cede00dac5da5a18ebbf7a9427767a | |
parent | d4d87d7eada1b69674ece975f14db942c6de1cae (diff) |
checksrc: improve the fopen() parser somewhat
The quote scanner was too fragile, now look for a comma instead to find
the mode argument.
-rwxr-xr-x | lib/checksrc.pl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/checksrc.pl b/lib/checksrc.pl index 0c1674621..f01eca3b3 100755 --- a/lib/checksrc.pl +++ b/lib/checksrc.pl @@ -6,7 +6,7 @@ # | (__| |_| | _ <| |___ # \___|\___/|_| \_\_____| # -# Copyright (C) 2011 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. +# Copyright (C) 2011 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al. # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -51,7 +51,7 @@ sub checkwarn { $supressed++; return; } - + my $w=$error?"error":"warning"; if($w) { @@ -212,7 +212,7 @@ sub scanfile { "comma without following space"); } } - + # check for "} else" if($l =~ /^(.*)\} *else/) { checkwarn($line, length($1), $file, $l, "else after closing brace on same line"); @@ -234,11 +234,11 @@ sub scanfile { } # scan for use of non-binary fopen without the macro - if($l =~ /^(.*\W)fopen\s*\([^"]*\"([^"]*)/) { + if($l =~ /^(.*\W)fopen\s*\([^,]*, *\"([^"]*)/) { my $mode = $2; if($mode !~ /b/) { checkwarn($line, length($1), $file, $l, - "use of non-binary fopen without FOPEN_* macro"); + "use of non-binary fopen without FOPEN_* macro: $mode"); } } |