[gtk-doc] fixxref: add a dir-cache to avoid scanning multiple times



commit 0a456223c562f8fb7d09d5192baf2245d76dc62a
Author: Stefan Sauer <ensonic users sf net>
Date:   Thu Sep 24 09:17:47 2015 +0200

    fixxref: add a dir-cache to avoid scanning multiple times
    
    Scanning for index files multiple times is not only slow, but would also trigger
    warnings multiple times.

 gtkdoc-fixxref.in |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gtkdoc-fixxref.in b/gtkdoc-fixxref.in
index 2fb8d8f..3d9e8d0 100755
--- a/gtkdoc-fixxref.in
+++ b/gtkdoc-fixxref.in
@@ -63,6 +63,8 @@ my %NoLinks = (
     'GInterface' => 1
 );
 
+# Cache of dirs we already scanned for index files
+my %DirCache;
 
 run() unless caller; # Run program unless loaded as a module
 
@@ -167,6 +169,8 @@ EOF
     # check all extra dirs, but skip already scanned dirs or subdirs of those
     foreach my $dir (@EXTRA_DIRS) {
         my $vdir;
+
+        $dir =~ s#/$##;
         @TRACE@("Scanning EXTRA_DIR directory: $dir");
     
         # If the --extra-dir option is not relative and is not sharing the same
@@ -188,6 +192,11 @@ EOF
 sub ScanIndices {
     my ($scan_dir, $use_absolute_links) = @_;
     
+    if (exists $DirCache{$scan_dir}) {
+        return;
+    }
+    $DirCache{$scan_dir} = 1;
+
     @TRACE@("Scanning source directory: $scan_dir absolute: $use_absolute_links");
 
     # This array holds any subdirectories found.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]