W3C home > Mailing lists > Public > www-validator-cvs@w3.org > December 2010

markup-validator commit: Avoid error log trashing for docs with no root namespace but some other ones.

From: Mercurial notifier <nobody@w3.org>
Date: Tue, 14 Dec 2010 22:15:57 +0000
Message-Id: <E1PSdA5-0003dl-Gm@mcbain.w3.org>
To: markup-validator updates <www-validator-cvs@w3.org>
changeset:   3192:d51bf903b549
user:        Ville Skyttä <ville.skytta@iki.fi>
date:        Tue Dec 14 23:17:16 2010 +0200
files:       httpd/cgi-bin/check
description:
Avoid error log trashing for docs with no root namespace but some other ones.


diff -r 45a1d08f64b4 -r d51bf903b549 httpd/cgi-bin/check
--- a/httpd/cgi-bin/check	Tue Dec 14 22:21:57 2010 +0200
+++ b/httpd/cgi-bin/check	Tue Dec 14 23:17:16 2010 +0200
@@ -1496,16 +1496,12 @@
 
     # Namespaces...
     $T->param(file_namespace => $File->{Namespace});
+
+    # Non-root ones; unique, preserving occurrence order
     my %seen_ns = ();
-    my @bulk_ns = @{$File->{Namespaces}};
-    $File->{Namespaces} = [];    # reinitialize the list of non-root namespaces
-                                 # ... and then get a uniq version of it
-    foreach my $single_namespace (@bulk_ns) {
-        push(@{$File->{Namespaces}}, $single_namespace)
-            unless (($single_namespace eq $File->{Namespace}) or
-            $seen_ns{$single_namespace}++);
-    }
-    my @nss = map({uri => $_}, @{$File->{Namespaces}});
+    $seen_ns{$File->{Namespace}}++ if defined($File->{Namespace});
+    my @nss =
+        map { $seen_ns{$_}++ == 0 ? {uri => $_} : () } @{$File->{Namespaces}};
     $T->param(file_namespaces => \@nss) if @nss;
 
     if ($File->{Opt}->{DOCTYPE}) {
Received on Tuesday, 14 December 2010 22:15:59 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:25 GMT