checksrc: fix possible endless loops/errors in the banned function logic
No binary (build failed)
—
(log yok)
| @@ -907,14 +907,9 @@ sub scanfile { | |
| checkwarn("BANNEDFUNC", | |
| $line, length($prefix), $file, $ol, | |
| "use of $bad is banned"); | |
| - | my $replace = 'x' x (length($bad) + 1); |
| - | $prefix =~ s/\*/\\*/; |
| - | $prefix =~ s/\[/\\[/; |
| - | $prefix =~ s/\]/\\]/; |
| - | $prefix =~ s/\(/\\(/; |
| - | $prefix =~ s/\)/\\)/; |
| - | $suff =~ s/\(/\\(/; |
| - | $l =~ s/$prefix$bad$suff/$prefix$replace/; |
| + | my $search = quotemeta($prefix . $bad . $suff); |
| + | my $replace = $prefix . 'x' x (length($bad) + 1); |
| + | $l =~ s/$search/$replace/; |
| goto again; | |
| } | |
| $l = $bl; # restore to pre-bannedfunc content | |