yangtse: curl-www/auto log.cgi,1.24,1.25

[email protected]
Newsgroups gmane.comp.web.curl.www.cvs
Message-ID <[email protected]>
Update of /cvsroot/curl/curl-www/auto
In directory labb:/tmp/cvs-serv2469/auto

Modified Files:
	log.cgi 
Log Message:
A - Improve speed:

  A1) In case the log file is not quoted-printable encoded, avoid
      copying 'chunk' to 'line', for each line in the file, setting
      'line' as a ref to 'chunk'.

  A2) Save four comparisons for each line in the file when searching
      for strings that start with 'testcurl:'.

B - Cosmetic adjustments:

  B1) In case some sort of problem is detected in the log file,
      leave a blank line beneath the "Jump to problem ..." line.

  B2) Uppercase 'F' for 'File not found!' string.

Index: log.cgi
===================================================================
RCS file: /cvsroot/curl/curl-www/auto/log.cgi,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- log.cgi	26 Feb 2007 13:10:35 -0000	1.24
+++ log.cgi	26 Feb 2007 19:57:59 -0000	1.25
@@ -76,26 +76,30 @@
                 next; # chunk
             }
         }
-        else {
-            $line = $chunk;
+        elsif(!$line) {
+            # if not qp encoded and ref is not set yet,
+            # set line as ref to chunk to avoid copy.
+            $line = "@{[$chunk]}";
         }
         chomp $line;
         #
         if($state) {
-            if($line =~ /^testcurl: ENDING HERE/) {
-                last;
-            }
-            elsif($line =~ /^testcurl: DESC = (.*)/) {
-                $description = $1;
-            }
-            elsif($line =~ /^testcurl: date = (.*)/) {
-                $date = $1;
-            }
-            elsif($line =~ /^testcurl: timestamp = (.*)/) {
-                $timestamp = $1;
-            }
-            elsif($line =~ /EMAIL/) {
-                $line =~ s:\@: /at/ :g;
+            if($line =~ /^testcurl: /) {
+                if($line =~ /^testcurl: ENDING HERE/) {
+                    last;
+                }
+                elsif($line =~ /^testcurl: DESC = (.*)/) {
+                    $description = $1;
+                }
+                elsif($line =~ /^testcurl: date = (.*)/) {
+                    $date = $1;
+                }
+                elsif($line =~ /^testcurl: timestamp = (.*)/) {
+                    $timestamp = $1;
+                }
+                elsif($line =~ /^testcurl: EMAIL/) {
+                    $line =~ s:\@: /at/ :g;
+                }
             }
             #
             if(checkwarn($line) || ($line =~ /FAILED/) || ($line =~ /MEMORY FAILURE/)) {
@@ -116,18 +120,19 @@
     push @out, "</div>\n"; # end of mini-div
     #
     if($num) {
-        print "jump down to ";
+        print "<div>Jump down to ";
         print "<a href=\"#prob1\">problem 1</a>\n";
         if($num>1) {
             print "<a href=\"#prob$num\">problem $num (last)</a>\n";
         }
+        print "</div><br>\n";
     }
     #
     print @out;
     #
 }
 else {
-    print "file not found!";
+    print "File not found!";
 }
 
 &catfile("foot.html");
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.