[svn:parrot] r48201 - trunk/src/string

NotFound at svn.parrot.org NotFound at svn.parrot.org
Wed Jul 28 14:59:46 UTC 2010


Author: NotFound
Date: Wed Jul 28 14:59:46 2010
New Revision: 48201
URL: https://trac.parrot.org/parrot/changeset/48201

Log:
use charset compute hash function when encoding has no its own, instead of blindly working around

Modified:
   trunk/src/string/api.c

Modified: trunk/src/string/api.c
==============================================================================
--- trunk/src/string/api.c	Wed Jul 28 14:16:50 2010	(r48200)
+++ trunk/src/string/api.c	Wed Jul 28 14:59:46 2010	(r48201)
@@ -2338,17 +2338,10 @@
 
     if (s->encoding->hash)
         hashval = ENCODING_HASH(interp, s, hashval);
+    else if (s->charset->compute_hash)
+        hashval = CHARSET_COMPUTE_HASH(interp, s, hashval);
     else {
-        /* ZZZZZ workaround for something not setting up encodings right */
-        ASSERT_STRING_SANITY(s);
-
-        ENCODING_ITER_INIT(interp, s, &iter);
-
-        for (offs = 0; offs < s->strlen; ++offs) {
-            const UINTVAL c = iter.get_and_advance(interp, &iter);
-            hashval += hashval << 5;
-            hashval += c;
-        }
+        exit_fatal(1, "String subsystem not properly initialized");
     }
 
     s->hashval = hashval;


More information about the parrot-commits mailing list