[svn:parrot] r45198 - in trunk: include/parrot src src/pmc

petdance at svn.parrot.org petdance at svn.parrot.org
Sat Mar 27 04:05:33 UTC 2010


Author: petdance
Date: Sat Mar 27 04:05:33 2010
New Revision: 45198
URL: https://trac.parrot.org/parrot/changeset/45198

Log:
Consting local vars, plus got to const an actual function argument which is the best consting of all

Modified:
   trunk/include/parrot/hash.h
   trunk/src/hash.c
   trunk/src/pmc/default.pmc

Modified: trunk/include/parrot/hash.h
==============================================================================
--- trunk/include/parrot/hash.h	Sat Mar 27 01:37:50 2010	(r45197)
+++ trunk/include/parrot/hash.h	Sat Mar 27 04:05:33 2010	(r45198)
@@ -121,7 +121,7 @@
 PARROT_EXPORT
 PARROT_WARN_UNUSED_RESULT
 INTVAL parrot_hash_exists(PARROT_INTERP,
-    ARGIN(Hash *hash),
+    ARGIN(const Hash *hash),
     ARGIN(void *key))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)

Modified: trunk/src/hash.c
==============================================================================
--- trunk/src/hash.c	Sat Mar 27 01:37:50 2010	(r45197)
+++ trunk/src/hash.c	Sat Mar 27 04:05:33 2010	(r45198)
@@ -1204,7 +1204,7 @@
         UINTVAL        i;
 
         for (i = 0; i < entries; i++) {
-            HashBucket *bucket = hash->bs + i;
+            HashBucket * const bucket = hash->bs + i;
 
             /* the hash->compare cost is too high for this fast path */
             if (bucket->key == key)
@@ -1256,7 +1256,7 @@
 
 /*
 
-=item C<INTVAL parrot_hash_exists(PARROT_INTERP, Hash *hash, void *key)>
+=item C<INTVAL parrot_hash_exists(PARROT_INTERP, const Hash *hash, void *key)>
 
 Returns whether the key exists in the hash.
 
@@ -1267,7 +1267,7 @@
 PARROT_EXPORT
 PARROT_WARN_UNUSED_RESULT
 INTVAL
-parrot_hash_exists(PARROT_INTERP, ARGIN(Hash *hash), ARGIN(void *key))
+parrot_hash_exists(PARROT_INTERP, ARGIN(const Hash *hash), ARGIN(void *key))
 {
     ASSERT_ARGS(parrot_hash_exists)
     const HashBucket * const bucket = parrot_hash_get_bucket(interp, hash, key);

Modified: trunk/src/pmc/default.pmc
==============================================================================
--- trunk/src/pmc/default.pmc	Sat Mar 27 01:37:50 2010	(r45197)
+++ trunk/src/pmc/default.pmc	Sat Mar 27 04:05:33 2010	(r45198)
@@ -917,7 +917,7 @@
 */
 
     VTABLE INTVAL isa(STRING *_class) {
-        Hash * const isa_hash = SELF->vtable->isa_hash;
+        const Hash * const isa_hash = SELF->vtable->isa_hash;
         if (!isa_hash)
             return Parrot_str_equal(interp, SELF->vtable->whoami, _class);
 


More information about the parrot-commits mailing list