[csw-devel] SF.net SVN: gar:[19800] csw/mgar/gar/v2/bin/cswproto

dmichelsen at users.sourceforge.net dmichelsen at users.sourceforge.net
Sat Dec 1 22:08:52 CET 2012


Revision: 19800
          http://gar.svn.sourceforge.net/gar/?rev=19800&view=rev
Author:   dmichelsen
Date:     2012-12-01 21:08:52 +0000 (Sat, 01 Dec 2012)
Log Message:
-----------
mGAR v2: Speed up cswproto

Modified Paths:
--------------
    csw/mgar/gar/v2/bin/cswproto

Modified: csw/mgar/gar/v2/bin/cswproto
===================================================================
--- csw/mgar/gar/v2/bin/cswproto	2012-12-01 16:05:47 UTC (rev 19799)
+++ csw/mgar/gar/v2/bin/cswproto	2012-12-01 21:08:52 UTC (rev 19800)
@@ -20,7 +20,7 @@
 use POSIX;
 
 use vars qw/
-    @XFORMS @Common $StdOwn $StdGrp $StdDirPerm $common $stamp $root
+    @XFORMS $Common $StdOwn $StdGrp $StdDirPerm $common $stamp $root
     /;
 
 # atime=8,mtime=9,ctime=10
@@ -69,9 +69,7 @@
 # Check whether a path is a 'common' file, defined in __DATA__
 sub is_common {
     my $path = shift;
-    foreach my $pat (@Common) {
-        return 1 if $path =~ m!^$pat$!;
-    }
+    return 1 if $path =~ /$Common/;
     return 0;
 }
 
@@ -108,7 +106,7 @@
 
 if( $common ) {
     # Load common path contents
-    my %alldirs;
+    my %alldirs = ('/' => 1);
     open F, $common || die "Couldn't open $common";
     while (<F>) {
         chomp; next if /^\s*$/ or /^#/;
@@ -119,7 +117,8 @@
         $alldirs{$_} = 1 foreach (@pc);
     }
     close F;
-    @Common = map { qr#$_$# } ('/', keys %alldirs);
+    my $re = '^(' . join( '|', keys %alldirs ) . ')$';
+    $Common = qr /$re/;
 }
 
 my @prototype;
@@ -160,7 +159,7 @@
         next unless $F[2];
 
         # Then process any excludes
-	next SPECLINE if( is_common( $F[2] ) );
+	next SPECLINE if( $F[2] =~ /$Common/ );
         next if exclude($realpath);
 
         # Fix up dir permissions/file ownership.

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list