[svn:parrot] r40134 - trunk/src/pmc

fperrad at svn.parrot.org fperrad at svn.parrot.org
Fri Jul 17 13:55:19 UTC 2009


Author: fperrad
Date: Fri Jul 17 13:55:17 2009
New Revision: 40134
URL: https://trac.parrot.org/parrot/changeset/40134

Log:
[cage] a lot of consting

Modified:
   trunk/src/pmc/arrayiterator.pmc
   trunk/src/pmc/hashiterator.pmc
   trunk/src/pmc/iterator.pmc
   trunk/src/pmc/orderedhashiterator.pmc
   trunk/src/pmc/stringiterator.pmc

Modified: trunk/src/pmc/arrayiterator.pmc
==============================================================================
--- trunk/src/pmc/arrayiterator.pmc	Fri Jul 17 10:19:17 2009	(r40133)
+++ trunk/src/pmc/arrayiterator.pmc	Fri Jul 17 13:55:17 2009	(r40134)
@@ -85,7 +85,7 @@
 */
 
     VTABLE void init_pmc(PMC *array) {
-        Parrot_ArrayIterator_attributes *attrs =
+        Parrot_ArrayIterator_attributes * const attrs =
             mem_allocate_zeroed_typed(Parrot_ArrayIterator_attributes);
 
         attrs->array     = array;
@@ -136,11 +136,11 @@
 
 */
     VTABLE PMC* clone() {
-        Parrot_ArrayIterator_attributes *attrs =
+        Parrot_ArrayIterator_attributes * const attrs =
                 PARROT_ARRAYITERATOR(SELF);
-        PMC                             *clone =
+        PMC                             * const clone =
                 pmc_new_init(INTERP, enum_class_ArrayIterator, attrs->array);
-        Parrot_ArrayIterator_attributes *clone_attrs =
+        Parrot_ArrayIterator_attributes * const clone_attrs =
                 PARROT_ARRAYITERATOR(clone);
 
         clone_attrs->pos     = attrs->pos;
@@ -173,7 +173,7 @@
 */
 
     VTABLE INTVAL elements() {
-        Parrot_ArrayIterator_attributes *attrs =
+        Parrot_ArrayIterator_attributes * const attrs =
                 PARROT_ARRAYITERATOR(SELF);
         if (attrs->reverse)
             return attrs->pos;
@@ -199,7 +199,7 @@
 */
 
     VTABLE void set_integer_native(INTVAL value) {
-        Parrot_ArrayIterator_attributes *attrs =
+        Parrot_ArrayIterator_attributes * const attrs =
                 PARROT_ARRAYITERATOR(SELF);
         if (value == ITERATE_FROM_START) {
             attrs->reverse   = 0;
@@ -244,7 +244,7 @@
 */
 
     VTABLE INTVAL shift_integer() {
-        Parrot_ArrayIterator_attributes *attrs =
+        Parrot_ArrayIterator_attributes * const attrs =
                 PARROT_ARRAYITERATOR(SELF);
 
         if (attrs->pos >= attrs->length)
@@ -263,7 +263,7 @@
 */
 
     VTABLE FLOATVAL shift_float() {
-        Parrot_ArrayIterator_attributes *attrs =
+        Parrot_ArrayIterator_attributes * const attrs =
                 PARROT_ARRAYITERATOR(SELF);
 
         if (!STATICSELF.get_bool())
@@ -283,7 +283,7 @@
 */
 
     VTABLE STRING *shift_string() {
-        Parrot_ArrayIterator_attributes *attrs =
+        Parrot_ArrayIterator_attributes * const attrs =
                 PARROT_ARRAYITERATOR(SELF);
 
         if (!STATICSELF.get_bool())
@@ -305,7 +305,7 @@
 */
 
     VTABLE PMC *shift_pmc() {
-        Parrot_ArrayIterator_attributes *attrs =
+        Parrot_ArrayIterator_attributes * const attrs =
                 PARROT_ARRAYITERATOR(SELF);
 
         if (!STATICSELF.get_bool())
@@ -328,7 +328,7 @@
 */
 
     VTABLE INTVAL pop_integer() {
-        Parrot_ArrayIterator_attributes *attrs =
+        Parrot_ArrayIterator_attributes * const attrs =
                 PARROT_ARRAYITERATOR(SELF);
 
         if (!STATICSELF.get_bool())
@@ -347,7 +347,7 @@
 */
 
     VTABLE FLOATVAL pop_float() {
-        Parrot_ArrayIterator_attributes *attrs =
+        Parrot_ArrayIterator_attributes * const attrs =
                 PARROT_ARRAYITERATOR(SELF);
 
         if (!STATICSELF.get_bool())
@@ -367,7 +367,7 @@
 */
 
     VTABLE STRING *pop_string() {
-        Parrot_ArrayIterator_attributes *attrs =
+        Parrot_ArrayIterator_attributes * const attrs =
                 PARROT_ARRAYITERATOR(SELF);
 
         if (!STATICSELF.get_bool())
@@ -389,7 +389,7 @@
 */
 
     VTABLE PMC *pop_pmc() {
-        Parrot_ArrayIterator_attributes *attrs =
+        Parrot_ArrayIterator_attributes * const attrs =
                 PARROT_ARRAYITERATOR(SELF);
 
         if (!STATICSELF.get_bool())
@@ -534,10 +534,10 @@
 */
 
     VTABLE INTVAL exists_keyed_int(INTVAL idx) {
-        Parrot_ArrayIterator_attributes *attrs =
+        Parrot_ArrayIterator_attributes * const attrs =
                 PARROT_ARRAYITERATOR(SELF);
         /* Cheat! */
-        INTVAL final_pos = attrs->pos + idx - attrs->reverse;
+        const INTVAL final_pos = attrs->pos + idx - attrs->reverse;
 
         return VTABLE_exists_keyed_int(INTERP, attrs->array, final_pos);
     }
@@ -565,10 +565,10 @@
 */
 
     VTABLE INTVAL defined_keyed_int(INTVAL idx) {
-        Parrot_ArrayIterator_attributes *attrs =
+        Parrot_ArrayIterator_attributes * const attrs =
                 PARROT_ARRAYITERATOR(SELF);
         /* Cheat! */
-        INTVAL final_pos = attrs->pos + idx - attrs->reverse;
+        const INTVAL final_pos = attrs->pos + idx - attrs->reverse;
 
         return VTABLE_defined_keyed_int(INTERP, attrs->array, final_pos);
     }

Modified: trunk/src/pmc/hashiterator.pmc
==============================================================================
--- trunk/src/pmc/hashiterator.pmc	Fri Jul 17 10:19:17 2009	(r40133)
+++ trunk/src/pmc/hashiterator.pmc	Fri Jul 17 13:55:17 2009	(r40134)
@@ -56,8 +56,8 @@
 */
 static HashBucket*
 advance_to_next(PARROT_INTERP, PMC *self) {
-    Parrot_HashIterator_attributes *attrs  = PARROT_HASHITERATOR(self);
-    HashBucket                     *bucket = attrs->bucket;
+    Parrot_HashIterator_attributes * const attrs  = PARROT_HASHITERATOR(self);
+    HashBucket                            *bucket = attrs->bucket;
 
     /* Try to advance current bucket */
     if (bucket)
@@ -95,7 +95,7 @@
 */
 
     VTABLE void init_pmc(PMC *hash) {
-        Parrot_HashIterator_attributes *attrs =
+        Parrot_HashIterator_attributes * const attrs =
             mem_allocate_zeroed_typed(Parrot_HashIterator_attributes);
 
         attrs->pmc_hash         = hash;
@@ -165,7 +165,7 @@
 
 */
     VTABLE void set_integer_native(INTVAL value) {
-        Parrot_HashIterator_attributes *attrs =
+        Parrot_HashIterator_attributes * const attrs =
                 PARROT_HASHITERATOR(SELF);
 
         if (value == 0) {
@@ -236,7 +236,7 @@
 */
 
     VTABLE PMC *shift_pmc() {
-        Parrot_HashIterator_attributes *attrs =
+        Parrot_HashIterator_attributes * const attrs =
                 PARROT_HASHITERATOR(SELF);
 
         PMC        *ret;
@@ -261,7 +261,7 @@
 */
 
     VTABLE STRING* shift_string() {
-        PMC *key = SELF.shift_pmc();
+        PMC * const key = SELF.shift_pmc();
         return VTABLE_get_string(INTERP, key);
     }
 

Modified: trunk/src/pmc/iterator.pmc
==============================================================================
--- trunk/src/pmc/iterator.pmc	Fri Jul 17 10:19:17 2009	(r40133)
+++ trunk/src/pmc/iterator.pmc	Fri Jul 17 13:55:17 2009	(r40134)
@@ -90,7 +90,7 @@
             || VTABLE_does(INTERP, aggregate, CONST_STRING(INTERP, "hash"))
             || VTABLE_does(INTERP, aggregate, CONST_STRING(INTERP, "string"))) {
             /* It's ugly hack... But I cant figure out proper way to do it. */
-            PMC *real_iter = VTABLE_get_iter(INTERP, aggregate);
+            PMC * const real_iter = VTABLE_get_iter(INTERP, aggregate);
             SELF = pmc_reuse_init(INTERP, SELF, VTABLE_type(INTERP, real_iter), aggregate, 0);
             return;
         }
@@ -199,7 +199,7 @@
     /* Make the shift_pmc vtable function available as
      * a method named "next" */
      METHOD next() {
-        PMC *next = VTABLE_shift_pmc(INTERP, SELF);
+        PMC * const next = VTABLE_shift_pmc(INTERP, SELF);
         RETURN(PMC* next);
      }
 

Modified: trunk/src/pmc/orderedhashiterator.pmc
==============================================================================
--- trunk/src/pmc/orderedhashiterator.pmc	Fri Jul 17 10:19:17 2009	(r40133)
+++ trunk/src/pmc/orderedhashiterator.pmc	Fri Jul 17 13:55:17 2009	(r40134)
@@ -40,7 +40,7 @@
 */
 
     VTABLE void init_pmc(PMC *hash) {
-        Parrot_OrderedHashIterator_attributes *attrs =
+        Parrot_OrderedHashIterator_attributes * const attrs =
             mem_allocate_zeroed_typed(Parrot_OrderedHashIterator_attributes);
 
         attrs->pmc_hash         = hash;

Modified: trunk/src/pmc/stringiterator.pmc
==============================================================================
--- trunk/src/pmc/stringiterator.pmc	Fri Jul 17 10:19:17 2009	(r40133)
+++ trunk/src/pmc/stringiterator.pmc	Fri Jul 17 13:55:17 2009	(r40134)
@@ -39,7 +39,7 @@
 
 */
     VTABLE void init_pmc(PMC *string) {
-        Parrot_StringIterator_attributes *attrs =
+        Parrot_StringIterator_attributes * const attrs =
             mem_allocate_zeroed_typed(Parrot_StringIterator_attributes);
 
         attrs->string    = string;
@@ -90,11 +90,11 @@
 
 */
     VTABLE PMC* clone() {
-        Parrot_StringIterator_attributes *attrs =
+        Parrot_StringIterator_attributes * const attrs =
                 PARROT_STRINGITERATOR(SELF);
-        PMC                              *clone =
+        PMC                              * const clone =
                 pmc_new_init(INTERP, enum_class_StringIterator, attrs->string);
-        Parrot_StringIterator_attributes *clone_attrs =
+        Parrot_StringIterator_attributes * const clone_attrs =
                 PARROT_STRINGITERATOR(clone);
 
         clone_attrs->pos     = attrs->pos;
@@ -127,7 +127,7 @@
 */
 
     VTABLE INTVAL elements() {
-        Parrot_StringIterator_attributes *attrs =
+        Parrot_StringIterator_attributes * const attrs =
                 PARROT_STRINGITERATOR(SELF);
         if (attrs->reverse)
             return attrs->pos;
@@ -153,7 +153,7 @@
 */
 
     VTABLE void set_integer_native(INTVAL value) {
-        Parrot_StringIterator_attributes *attrs =
+        Parrot_StringIterator_attributes * const attrs =
                 PARROT_STRINGITERATOR(SELF);
         if (value == ITERATE_FROM_START) {
             attrs->reverse   = 0;
@@ -196,7 +196,7 @@
 
 */
     VTABLE PMC *shift_pmc() {
-        Parrot_StringIterator_attributes *attrs =
+        Parrot_StringIterator_attributes * const attrs =
                 PARROT_STRINGITERATOR(SELF);
         PMC *ret;
 
@@ -220,7 +220,7 @@
 
 */
     VTABLE STRING *shift_string() {
-        Parrot_StringIterator_attributes *attrs =
+        Parrot_StringIterator_attributes * const attrs =
                 PARROT_STRINGITERATOR(SELF);
 
         if (attrs->pos >= attrs->length)
@@ -240,7 +240,7 @@
 
 */
     VTABLE INTVAL shift_integer() {
-        Parrot_StringIterator_attributes *attrs =
+        Parrot_StringIterator_attributes * const attrs =
                 PARROT_STRINGITERATOR(SELF);
 
         if (attrs->pos >= attrs->length)
@@ -260,7 +260,7 @@
 
 */
     VTABLE PMC *pop_pmc() {
-        Parrot_StringIterator_attributes *attrs =
+        Parrot_StringIterator_attributes * const attrs =
                 PARROT_STRINGITERATOR(SELF);
         PMC *ret;
 
@@ -284,7 +284,7 @@
 
 */
     VTABLE STRING *pop_string() {
-        Parrot_StringIterator_attributes *attrs =
+        Parrot_StringIterator_attributes * const attrs =
                 PARROT_STRINGITERATOR(SELF);
 
         if (!STATICSELF.get_bool())
@@ -304,7 +304,7 @@
 
 */
     VTABLE INTVAL pop_integer() {
-        Parrot_StringIterator_attributes *attrs =
+        Parrot_StringIterator_attributes * const attrs =
                 PARROT_STRINGITERATOR(SELF);
 
         if (!STATICSELF.get_bool())


More information about the parrot-commits mailing list