Skip to contentSkip to conversation

scripts/kernel-doc: track line numbers for each file separately

PATCH New Randy Dunlap 1 participant 1 message Feb 26, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 scripts/kernel-doc: track line numbers for each file separately

From: Ilya Dryomov <[email protected]>
Subject: kernel-doc: track line numbers for each file separately

The problem is that $. keeps track of the current record number (which is line number by default). But if you pass it multiple files, it does not wrap at the end of file, and therefore contains the *total* number of processed lines.
I suppose we can fix line numbering by introducing a simple assignment $. = 1
before processing every new file.

---
 scripts/kernel-doc |    2 ++
 1 file changed, 2 insertions(+)
scripts/kernel-doc +2 -0
@@ -2023,6 +2023,8 @@ sub process_file($) {
 	return;
     }
 
+    $. = 1;
+
     $section_counter = 0;
     while (<IN>) {
 	if ($state == 0) {