diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2001-05-22 23:08:09 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-05-23 21:24:30 +0000 |
commit | 844495fbb8769a576a75dd72ddbc0cd5b94672b6 (patch) | |
tree | 1bf3cb1310bf3da5eac06888acaf0080c918194c /emacs | |
parent | e6d61defd5684ffe8111cd203c104889369b780a (diff) | |
download | perl-844495fbb8769a576a75dd72ddbc0cd5b94672b6.tar.gz |
big speedup
Message-Id: <200105222108.WAA09442@gizmo.fdgroup.co.uk>
p4raw-id: //depot/perl@10182
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/e2ctags.pl | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/emacs/e2ctags.pl b/emacs/e2ctags.pl index ef7a8d8539..34e3e14b54 100644 --- a/emacs/e2ctags.pl +++ b/emacs/e2ctags.pl @@ -16,6 +16,7 @@ use strict; my $filename; my ($tag,$line_no,$line); my %tags = (); +my %filetags = (); my %files = (); my @lines = (); @@ -34,21 +35,17 @@ while (<>) { next if /struct/; if (/\x01/) { ($tag,$line_no) = /\x7F(\w+)\x01(\d+)/; - next unless $tag; - ##Take only the first entry per tag - next if defined($tags{$tag}); - $tags{$tag}{FILE} = $filename; - $tags{$tag}{LINE_NO} = $line_no; } else { tr/(//d; ($tag,$line_no) = /(\w+)\s*\x7F(\d+),/; - next unless $tag; - ##Take only the first entry per tag - next if defined($tags{$tag}); - $tags{$tag}{FILE} = $filename; - $tags{$tag}{LINE_NO} = $line_no; } + next unless $tag; + ##Take only the first entry per tag + next if defined($tags{$tag}); + $tags{$tag}{FILE} = $filename; + $tags{$tag}{LINE_NO} = $line_no; + push @{$filetags{$filename}}, $tag; } foreach $filename (keys %files) { @@ -56,8 +53,7 @@ foreach $filename (keys %files) { @lines = <FILE>; close FILE; chomp @lines; - foreach $tag ( keys %tags ) { - next unless $filename eq $tags{$tag}{FILE}; + foreach $tag ( @{$filetags{$filename}} ) { $line = $lines[$tags{$tag}{LINE_NO}-1]; if (length($line) >= 50) { $line = substr($line,0,50); |