link-checker commit: Avoid "uninitialized numeric eq" warnings with fragments do docs from which we don't support checking fragments.

changeset:   404:2c8c10e21cf0
tag:         tip
user:        Ville Skyttä <ville.skytta@iki.fi>
date:        Sat May 14 12:53:39 2011 +0300
files:       bin/checklink
description:
Avoid "uninitialized numeric eq" warnings with fragments do docs from which we don't support checking fragments.

http://www.w3.org/Bugs/Public/show_bug.cgi?id=12571


diff -r 81914ff50f48 -r 2c8c10e21cf0 bin/checklink
--- a/bin/checklink	Fri Apr 29 22:42:40 2011 +0300
+++ b/bin/checklink	Sat May 14 12:53:39 2011 +0300
@@ -1302,22 +1302,22 @@
 
             # List the broken fragments
             while (my ($fragment, $lines) = each(%{$ulinks->{fragments}})) {
+
+                my $fragment_ok = $results{$u}{fragments}{$fragment};
+
                 if ($Opts{Verbose}) {
                     my @line_nums = sort { $a <=> $b } keys(%$lines);
                     &hprintf(
                         "\t\t%s %s - Line%s: %s\n",
                         $fragment,
-                        ($results{$u}{fragments}{$fragment}) ? 'OK' :
-                            'Not found',
-                        (scalar(@line_nums) > 1) ? 's' : '',
+                        $fragment_ok             ? 'OK' : 'Not found',
+                        (scalar(@line_nums) > 1) ? 's'  : '',
                         join(', ', @line_nums)
                     );
                 }
 
                 # A broken fragment?
-                if ($results{$u}{fragments}{$fragment} == 0) {
-                    $broken{$u}{fragments}{$fragment} += 2;
-                }
+                $broken{$u}{fragments}{$fragment} += 2 unless $fragment_ok;
             }
         }
         elsif (!($Opts{Quiet} && &informational($results{$u}{location}{code})))

Received on Saturday, 14 May 2011 09:54:06 UTC