Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1419464

[docs-next PATCH 4/9] kernel-doc: abstract filename mapping

From Jani Nikula <jani.nikula@intel.com>
Newsgroups linux.kernel
Subject [docs-next PATCH 4/9] kernel-doc: abstract filename mapping
Date 2016-06-10 16:20 +0200
Message-ID <rIvrY-5BP-23@gated-at.bofh.it> (permalink)
References <rIvrX-5BP-1@gated-at.bofh.it>
Organization Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo

Show all headers | View raw


Reduce duplication in follow-up work. No functional changes.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 scripts/kernel-doc | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index a6f82c812c15..516d95fcefb7 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -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;
-- 
2.1.4

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[docs-next PATCH 0/9] Documentation/sphinx follow-up Jani Nikula <jani.nikula@intel.com> - 2016-06-10 16:20 +0200
  [docs-next PATCH 3/9] kernel-doc: add missing semi-colons in option parsing Jani Nikula <jani.nikula@intel.com> - 2016-06-10 16:20 +0200
  [docs-next PATCH 4/9] kernel-doc: abstract filename mapping Jani Nikula <jani.nikula@intel.com> - 2016-06-10 16:20 +0200
  [docs-next PATCH 2/9] kernel-doc: do not warn about duplicate default section names Jani Nikula <jani.nikula@intel.com> - 2016-06-10 16:20 +0200
  [docs-next PATCH 7/9] Documentation/sphinx: remove unnecessary temporary variable Jani Nikula <jani.nikula@intel.com> - 2016-06-10 16:20 +0200
  [docs-next PATCH 1/9] kernel-doc: remove old debug cruft from dump_section() Jani Nikula <jani.nikula@intel.com> - 2016-06-10 16:20 +0200
  [docs-next PATCH 9/9] Documentation/sphinx: add support for specifying extra export files Jani Nikula <jani.nikula@intel.com> - 2016-06-10 16:20 +0200
  [docs-next PATCH 8/9] Documentation/sphinx: use a more sensible string split in kernel-doc extension Jani Nikula <jani.nikula@intel.com> - 2016-06-10 16:20 +0200

csiph-web