[svn:parrot] r38357 - trunk/tools/build

Infinoid at svn.parrot.org Infinoid at svn.parrot.org
Sat Apr 25 22:46:23 UTC 2009


Author: Infinoid
Date: Sat Apr 25 22:46:22 2009
New Revision: 38357
URL: https://trac.parrot.org/parrot/changeset/38357

Log:
[tools] The hash_val output of c2str isn't used anyway, just get rid of it.

Modified:
   trunk/tools/build/c2str.pl

Modified: trunk/tools/build/c2str.pl
==============================================================================
--- trunk/tools/build/c2str.pl	Sat Apr 25 22:46:15 2009	(r38356)
+++ trunk/tools/build/c2str.pl	Sat Apr 25 22:46:22 2009	(r38357)
@@ -67,25 +67,14 @@
     return length $s;
 }
 
-sub hash_val {
-    my $h = 0;
-    my $s = shift;
-    for ( my $i = 0 ; $i < length($s) ; ++$i ) {
-        $h &= 0x03ffffff;
-        $h += $h << 5;
-        $h ^= ord substr( $s, $i, 1 );
-    }
-    return sprintf( "0x%x", $h );
-}
-
 sub read_all {
     $ALL->seek(0, 0);
     while (<$ALL>) {
 
         # len hashval "string"
-        if (/(\d+)\s+(0x[\da-hA-H]+)\s+"(.*)"/) {
-            push @all_strings, [ $1, $2, $3 ];
-            $known_strings{$3} = @all_strings;
+        if (/(\d+)\s+"(.*)"/) {
+            push @all_strings, [ $1, $2 ];
+            $known_strings{$2} = @all_strings;
         }
     }
     return;
@@ -178,14 +167,13 @@
         }
 
         my $len               = get_length($str);
-        my $hashval           = hash_val($str);
-        push @all_strings, [ $len, $hashval, $str ];
+        push @all_strings, [ $len, $str ];
 
         $n                    = @all_strings;
         $known_strings{$str}  = $n;
         $this_file_seen{"$const_string:$str"} = $line;
         print "#define _${const_string}_$line $n\n";
-        print $ALL qq!$len\t$hashval\t"$str"\n!;
+        print $ALL qq!$len\t"$str"\n!;
     }
     close($IN);
     return;
@@ -213,14 +201,13 @@
 
 static const struct _cstrings {
     UINTVAL len;
-    Parrot_UInt4 hash_val;
     const char *string;
 } parrot_cstrings[] = {
-    { 0, 0, "" },
+    { 0, "" },
 HEADER
     my @all;
     for my $s (@all_strings) {
-        push @all, qq!    {$s->[0], $s->[1], "$s->[2]"}!;
+        push @all, qq!    {$s->[0], "$s->[1]"}!;
     }
     print $OUT join( ",\n", @all );
     print $OUT <<HEADER;


More information about the parrot-commits mailing list