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

link-checker commit: Code cleanups.

From: Mercurial notifier <nobody@w3.org>
Date: Thu, 05 Aug 2010 14:46:56 +0000
To: link-checker updates <www-validator-cvs@w3.org>
Message-Id: <E1Oh1ii-0005Zd-PS@blinky.w3.org>
changeset:   53:a69f7cae89f3
user:        ville
date:        Sat Apr 10 22:44:51 2004 +0000
files:       bin/checklink
description:
Code cleanups.


diff -r a1ecac030c90 -r a69f7cae89f3 bin/checklink
--- a/bin/checklink	Sat Apr 10 19:01:26 2004 +0000
+++ b/bin/checklink	Sat Apr 10 22:44:51 2004 +0000
@@ -5,7 +5,7 @@
 # (c) 1999-2004 World Wide Web Consortium
 # based on Renaud Bruyeron's checklink.pl
 #
-# $Id: checklink,v 3.28 2004-04-10 19:01:26 ville Exp $
+# $Id: checklink,v 3.29 2004-04-10 22:44:51 ville Exp $
 #
 # This program is licensed under the W3C(r) Software License:
 #       http://www.w3.org/Consortium/Legal/copyright-software
@@ -112,7 +112,7 @@
   $PACKAGE       = 'W3C Link Checker';
   $PROGRAM       = 'W3C-checklink';
   $VERSION       = '3.9.3-dev';
-  my ($cvsver)   = q$Revision: 3.28 $ =~ /(\d+[\d\.]*\.\d+)/;
+  my ($cvsver)   = q$Revision: 3.29 $ =~ /(\d+[\d\.]*\.\d+)/;
   $REVISION      = sprintf('version %s [%s] (c) 1999-2004 W3C',
                            $VERSION, $cvsver);
   $AGENT         = sprintf('%s/%s [%s] %s',
@@ -1540,6 +1540,7 @@
     }
 
     my ($redirect_loop, @redirects_urls) = get_redirects($u, %$redirects);
+    my $currloc = $results->{$u}{location};
 
     # Error type
     $c = &code_shown($u, $results);
@@ -1547,7 +1548,7 @@
     my $whattodo;
     my $redirect_too;
     if ($todo) {
-      my $currmsg = $results->{$u}{location}{message} || '';
+      my $currmsg = $currloc->{message} || '';
       if ($u =~ m/^javascript:/) {
         if ($Opts{HTML}) {
           $whattodo =
@@ -1610,8 +1611,8 @@
       }
       # HTTP message
       my $http_message;
-      if ($results->{$u}{location}{message}) {
-        $http_message = &encode($results->{$u}{location}{message});
+      if ($currloc->{message}) {
+        $http_message = &encode($currloc->{message});
         if ($c == 404 || $c == 500) {
           $http_message = '<span class="broken">'.
             $http_message.'</span>';
@@ -1639,20 +1640,18 @@
              $redirect_too ?
              sprintf(' <span %s>%s</span>', &bgcolor(301), $redirect_too) : '',
              # Original HTTP reply
-             $results->{$u}{location}{orig},
+             $currloc->{orig},
              # Final HTTP reply
-             ($results->{$u}{location}{code} !=
-              $results->{$u}{location}{orig})
+             ($currloc->{code} != $currloc->{orig})
              ? ' <span title="redirected to">-&gt;</span> '.
-             &encode($results->{$u}{location}{code})
+             &encode($currloc->{code})
              : '',
              # Realm
-             (defined($results->{$u}{location}{realm})
-              ? 'Realm: '.&encode($results->{$u}{location}{realm}).'<br>'
-              : ''),
+             defined($currloc->{realm})
+             ? sprintf('Realm: %s<br>', &encode($currloc->{realm})) : '',
              # HTTP original message
-             defined($results->{$u}{location}{orig_message})
-             ? &encode($results->{$u}{location}{orig_message}).
+             defined($currloc->{orig_message})
+             ? &encode($currloc->{orig_message}).
              ' <span title="redirected to">-&gt;</span> '
              : '',
              # HTTP final message
@@ -1662,7 +1661,7 @@
              $lines_list);
       if ($#fragments >= 0) {
         my $fragment_direction = '';
-        if ($results->{$u}{location}{code} == 200) {
+        if ($currloc->{code} == 200) {
           $fragment_direction =
             ' <strong class="broken">They need to be fixed!</strong>';
         }
@@ -1677,18 +1676,17 @@
              # List of lines
              $lines_list ? "Line$s: $lines_list" : '',
              # Original HTTP reply
-             $results->{$u}{location}{orig},
+             $currloc->{orig},
              # Final HTTP reply
-             ($results->{$u}{location}{code} != $results->{$u}{location}{orig})
-             ? ' -> '.$results->{$u}{location}{code}
+             ($currloc->{code} != $currloc->{orig})
+             ? ' -> '.$currloc->{code}
              : '',
              # HTTP message
-             $results->{$u}{location}{message} ?
-             $results->{$u}{location}{message} : '',
+             $currloc->{message} || '',
              # What to do
              wrap(' To do: ', '        ', $whattodo));
       if ($#fragments >= 0) {
-        if ($results->{$u}{location}{code} == 200) {
+        if ($currloc->{code} == 200) {
           print("The following fragments need to be fixed:\n");
         } else {
           print("Fragments:\n");
Received on Thursday, 5 August 2010 14:47:10 UTC

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