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

NotFound at svn.parrot.org NotFound at svn.parrot.org
Thu Aug 12 09:30:41 UTC 2010


Author: NotFound
Date: Thu Aug 12 09:30:40 2010
New Revision: 48428
URL: https://trac.parrot.org/parrot/changeset/48428

Log:
drop unused local variables and clean code in Parrot_str_to_hashval

Modified:
   trunk/src/string/api.c

Modified: trunk/src/string/api.c
==============================================================================
--- trunk/src/string/api.c	Thu Aug 12 04:47:38 2010	(r48427)
+++ trunk/src/string/api.c	Thu Aug 12 09:30:40 2010	(r48428)
@@ -2329,22 +2329,20 @@
 Parrot_str_to_hashval(PARROT_INTERP, ARGMOD_NULLOK(STRING *s))
 {
     ASSERT_ARGS(Parrot_str_to_hashval)
-    String_iter iter;
-    UINTVAL     offs;
-    size_t      hashval = interp->hash_seed;
 
-    if (STRING_IS_NULL(s) || !s->strlen)
-        return hashval;
+    size_t hashval = interp->hash_seed;
 
-    if (s->encoding->hash)
-        hashval = ENCODING_HASH(interp, s, hashval);
-    else if (s->charset->compute_hash)
-        hashval = CHARSET_COMPUTE_HASH(interp, s, hashval);
-    else {
-        exit_fatal(1, "String subsystem not properly initialized");
-    }
+    if ((!STRING_IS_NULL(s)) && s->strlen) {
+        if (s->encoding->hash)
+            hashval = ENCODING_HASH(interp, s, hashval);
+        else if (s->charset->compute_hash)
+            hashval = CHARSET_COMPUTE_HASH(interp, s, hashval);
+        else {
+            exit_fatal(1, "String subsystem not properly initialized");
+        }
 
-    s->hashval = hashval;
+        s->hashval = hashval;
+    }
 
     return hashval;
 }


More information about the parrot-commits mailing list