[svn:parrot] r49127 - trunk/src
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Sat Sep 18 03:22:48 UTC 2010
Author: chromatic
Date: Sat Sep 18 03:22:48 2010
New Revision: 49127
URL: https://trac.parrot.org/parrot/changeset/49127
Log:
[hash] Used more parrot_hash_get_bucket_string().
Now parrot_hash_get_bucket() is shorter, and everyone cheers.
Modified:
trunk/src/hash.c
Modified: trunk/src/hash.c
==============================================================================
--- trunk/src/hash.c Sat Sep 18 03:03:26 2010 (r49126)
+++ trunk/src/hash.c Sat Sep 18 03:22:48 2010 (r49127)
@@ -1398,7 +1398,6 @@
{
ASSERT_ARGS(parrot_hash_get_bucket)
DECL_CONST_CAST;
- HashBucket *bucket;
if (hash->entries <= 0)
return NULL;
@@ -1407,30 +1406,12 @@
STRING * const s = (STRING *)PARROT_const_cast(void *, key);
const size_t hashval = key_hash_STRING(interp, s, hash->seed);
- bucket = hash->index[hashval & hash->mask];
-
- while (bucket) {
- const STRING *s2 = (const STRING *)bucket->key;
-
- if (s == s2)
- break;
- /* manually inline part of string_equal */
- if (hashval == s2->hashval) {
- if (s->encoding == s2->encoding){
- if ((STRING_byte_length(s) == STRING_byte_length(s2))
- && (memcmp(s->strstart, s2->strstart, STRING_byte_length(s)) == 0))
- break;
- } else if (Parrot_str_equal(interp, s, s2))
- break;
- }
-
- bucket = bucket->next;
- }
+ return parrot_hash_get_bucket_string(interp, hash, s, hashval);
}
else {
const size_t hashval = key_hash(interp, hash,
PARROT_const_cast(void *, key));
- bucket = hash->index[hashval & hash->mask];
+ HashBucket *bucket = hash->index[hashval & hash->mask];
while (bucket) {
if (hash_compare(interp, hash,
@@ -1439,9 +1420,9 @@
break;
bucket = bucket->next;
}
- }
- return bucket;
+ return bucket;
+ }
}
/*
More information about the parrot-commits
mailing list