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

markup-validator commit: Make finding transcode error line number more memory efficient.

From: Mercurial notifier <nobody@w3.org>
Date: Tue, 14 Dec 2010 22:15:57 +0000
Message-Id: <E1PSdA5-0003e5-SW@mcbain.w3.org>
To: markup-validator updates <www-validator-cvs@w3.org>
changeset:   3194:c1b3289341f5
user:        Ville Skyttä <ville.skytta@iki.fi>
date:        Wed Dec 15 00:05:28 2010 +0200
files:       httpd/cgi-bin/check
description:
Make finding transcode error line number more memory efficient.


diff -r c226e4a4ebd7 -r c1b3289341f5 httpd/cgi-bin/check
--- a/httpd/cgi-bin/check	Tue Dec 14 23:44:45 2010 +0200
+++ b/httpd/cgi-bin/check	Wed Dec 15 00:05:28 2010 +0200
@@ -3222,9 +3222,9 @@
         # Transcoding failed - do it again line by line to find out exactly
         # where
         my $line_num = 0;
-        foreach my $input_line (split /\r\n|\n|\r/, $input) {
+        while ($input =~ /(.*?)(?:\r\n|\n|\r)/g) {
             $line_num++;
-            eval { $enc->decode($input_line, Encode::FB_CROAK); };
+            eval { $enc->decode($1, Encode::FB_CROAK); };
             if ($@) {
                 my $croak_message = $@;
                 $croak_message =~ s/ at .*//;
Received on Tuesday, 14 December 2010 22:16:00 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:44 UTC