kernel-doc: abstract filename mapping

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

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
Jani Nikula 2016-06-07 10:53:39 +03:00
Родитель da9726ecfb
Коммит 1ad560e43c
1 изменённых файлов: 18 добавлений и 9 удалений

Просмотреть файл

@ -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";