kernel-doc: abstract filename mapping
authorJani Nikula <jani.nikula@intel.com>
Tue, 7 Jun 2016 07:53:39 +0000 (10:53 +0300)
committerJani Nikula <jani.nikula@intel.com>
Fri, 10 Jun 2016 08:29:19 +0000 (11:29 +0300)
Reduce duplication in follow-up work. No functional changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
scripts/kernel-doc

index a6f82c8..516d95f 100755 (executable)
@@ -2730,26 +2730,35 @@ sub local_unescape($) {
        return $text;
 }
 
-sub process_file($) {
+sub map_filename($) {
     my $file;
-    my $identifier;
-    my $func;
-    my $descr;
-    my $in_purpose = 0;
-    my $initial_section_counter = $section_counter;
     my ($orig_file) = @_;
-    my $leading_space;
 
     if (defined($ENV{'SRCTREE'})) {
        $file = "$ENV{'SRCTREE'}" . "/" . $orig_file;
-    }
-    else {
+    } else {
        $file = $orig_file;
     }
+
     if (defined($source_map{$file})) {
        $file = $source_map{$file};
     }
 
+    return $file;
+}
+
+sub process_file($) {
+    my $file;
+    my $identifier;
+    my $func;
+    my $descr;
+    my $in_purpose = 0;
+    my $initial_section_counter = $section_counter;
+    my ($orig_file) = @_;
+    my $leading_space;
+
+    $file = map_filename($orig_file);
+
     if (!open(IN,"<$file")) {
        print STDERR "Error: Cannot open file $file\n";
        ++$errors;