1
0
Fork 0

kernel-doc: abstract filename mapping

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

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
hifive-unleashed-5.1
Jani Nikula 2016-06-07 10:53:39 +03:00
parent da9726ecfb
commit 1ad560e43c
1 changed files with 18 additions and 9 deletions

View File

@ -2730,6 +2730,23 @@ sub local_unescape($) {
return $text;
}
sub map_filename($) {
my $file;
my ($orig_file) = @_;
if (defined($ENV{'SRCTREE'})) {
$file = "$ENV{'SRCTREE'}" . "/" . $orig_file;
} else {
$file = $orig_file;
}
if (defined($source_map{$file})) {
$file = $source_map{$file};
}
return $file;
}
sub process_file($) {
my $file;
my $identifier;
@ -2740,15 +2757,7 @@ sub process_file($) {
my ($orig_file) = @_;
my $leading_space;
if (defined($ENV{'SRCTREE'})) {
$file = "$ENV{'SRCTREE'}" . "/" . $orig_file;
}
else {
$file = $orig_file;
}
if (defined($source_map{$file})) {
$file = $source_map{$file};
}
$file = map_filename($orig_file);
if (!open(IN,"<$file")) {
print STDERR "Error: Cannot open file $file\n";