Skip to contentSkip to conversation

checkpatch: clear the report buffer after processing a file

PATCH In review Li Zefan 2 participants 2 messages Jan 15, 2008 – Jan 17, 2008 Checkpatch

lore
Share & tools
lore

Li Zefan

author
#0 lore raw

PATCH 1/1 checkpatch: clear the report buffer after processing a file

When checking multiple files, the report buffer is not cleared after processing a file, thus the report will be printed again and again, mixing up with other reports.

---
 scripts/checkpatch.pl |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +3 -3
index 579f50f..a88f7a1 100755
@@ -624,16 +624,15 @@ sub possible {
 
 my $prefix = '';
 
-my @report = ();
 sub report {
 	my $line = $prefix . $_[0];
 
 	$line = (split('\n', $line))[0] . "\n" if ($terse);
 
-	push(@report, $line);
+	push(our @report, $line);
 }
 sub report_dump {
-	@report;
+	our @report;
 }
 sub ERROR {
 	report("ERROR: $_[0]\n");
@@ -670,6 +669,7 @@ sub process {
 	my $signoff = 0;
 	my $is_patch = 0;
 
+	our @report = ();
 	our $cnt_lines = 0;
 	our $cnt_error = 0;
 	our $cnt_warn = 0;
Signature · 1 line
1.5.3.rc7
#1 lore raw
Quoted 6 lines · Li Zefan

When checking multiple files, the report buffer is not cleared after processing a file, thus the report will be printed again and again, mixing up with other reports.

Yep, this is clearly broken. Never used it with more than one file. We also accumulate the files in the current version. I'll fix that up as I merge this.

Thanks for the patch.

-apw