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

petdance at svn.parrot.org petdance at svn.parrot.org
Tue Mar 30 22:27:15 UTC 2010


Author: petdance
Date: Tue Mar 30 22:27:14 2010
New Revision: 45331
URL: https://trac.parrot.org/parrot/changeset/45331

Log:
consting, and localized a loop variable

Modified:
   trunk/src/pmc/packfilerawsegment.pmc

Modified: trunk/src/pmc/packfilerawsegment.pmc
==============================================================================
--- trunk/src/pmc/packfilerawsegment.pmc	Tue Mar 30 22:26:42 2010	(r45330)
+++ trunk/src/pmc/packfilerawsegment.pmc	Tue Mar 30 22:27:14 2010	(r45331)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2001-2008, Parrot Foundation.
+Copyright (C) 2001-2010, Parrot Foundation.
 $Id$
 
 =head1 NAME
@@ -65,7 +65,7 @@
 */
 
     VTABLE void mark() {
-        Parrot_PackfileRawSegment_attributes * attrs =
+        Parrot_PackfileRawSegment_attributes * const attrs =
                 PARROT_PACKFILERAWSEGMENT(SELF);
 
         Parrot_gc_mark_PMC_alive(interp, attrs->opcodes);
@@ -87,15 +87,16 @@
     VTABLE void set_pointer(void * pointer) {
         const PackFile_Segment * const pfseg =
                 (const PackFile_Segment *)pointer;
-        Parrot_PackfileRawSegment_attributes * attrs =
+        Parrot_PackfileRawSegment_attributes * const attrs =
                 PARROT_PACKFILERAWSEGMENT(SELF);
-        PMC * opcodes = attrs->opcodes;
-        size_t i;
+        PMC * const opcodes = attrs->opcodes;
 
         /* Preserve type of unpacked segment */
         attrs->type = pfseg->type;
 
         if (pfseg->size) {
+            size_t i;
+
             /* copy data to own array */
             VTABLE_set_integer_native(interp, opcodes, pfseg->size);
             /* Not very efficient... */
@@ -116,7 +117,7 @@
     VTABLE void *get_pointer() {
         PackFile_Segment * pfseg =
                 (PackFile_Segment*)mem_gc_allocate_zeroed_typed(INTERP, PackFile_ByteCode);
-        Parrot_PackfileRawSegment_attributes * attrs =
+        Parrot_PackfileRawSegment_attributes * const attrs =
                 PARROT_PACKFILERAWSEGMENT(SELF);
         PMC * opcodes = attrs->opcodes;
         size_t i;
@@ -203,7 +204,7 @@
 */
 
     METHOD type(INTVAL type :optional, INTVAL got_type :opt_flag) {
-        Parrot_PackfileRawSegment_attributes * attrs =
+        Parrot_PackfileRawSegment_attributes * const attrs =
                 PARROT_PACKFILERAWSEGMENT(SELF);
         INTVAL res;
 


More information about the parrot-commits mailing list