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:
parent
da9726ecfb
commit
1ad560e43c
@ -2730,6 +2730,23 @@ sub local_unescape($) {
|
|||||||
return $text;
|
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($) {
|
sub process_file($) {
|
||||||
my $file;
|
my $file;
|
||||||
my $identifier;
|
my $identifier;
|
||||||
@ -2740,15 +2757,7 @@ sub process_file($) {
|
|||||||
my ($orig_file) = @_;
|
my ($orig_file) = @_;
|
||||||
my $leading_space;
|
my $leading_space;
|
||||||
|
|
||||||
if (defined($ENV{'SRCTREE'})) {
|
$file = map_filename($orig_file);
|
||||||
$file = "$ENV{'SRCTREE'}" . "/" . $orig_file;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$file = $orig_file;
|
|
||||||
}
|
|
||||||
if (defined($source_map{$file})) {
|
|
||||||
$file = $source_map{$file};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!open(IN,"<$file")) {
|
if (!open(IN,"<$file")) {
|
||||||
print STDERR "Error: Cannot open file $file\n";
|
print STDERR "Error: Cannot open file $file\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user