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

petdance at svn.parrot.org petdance at svn.parrot.org
Fri Feb 6 07:28:28 UTC 2009


Author: petdance
Date: Fri Feb  6 07:28:27 2009
New Revision: 36398
URL: https://trac.parrot.org/parrot/changeset/36398

Log:
localizing vars and consting

Modified:
   trunk/src/pmc/stringhandle.pmc

Modified: trunk/src/pmc/stringhandle.pmc
==============================================================================
--- trunk/src/pmc/stringhandle.pmc	Fri Feb  6 02:30:21 2009	(r36397)
+++ trunk/src/pmc/stringhandle.pmc	Fri Feb  6 07:28:27 2009	(r36398)
@@ -157,7 +157,7 @@
 
     METHOD open(STRING *filename :optional, INTVAL got_filename :opt_flag,
                 STRING *mode :optional, INTVAL got_mode :opt_flag) {
-        STRING *open_mode, *old_string, *new_string, *encoding;
+        STRING *open_mode, *old_string;
         INTVAL flags;
 
         if (got_mode && !STRING_IS_NULL(mode))
@@ -170,6 +170,9 @@
         /* If StringHandle hasn't already been initialized, create a new string. */
         GET_ATTR_stringhandle(INTERP, SELF, old_string);
         if (STRING_IS_NULL(old_string)) {
+            STRING *new_string;
+            STRING *encoding;
+
             GET_ATTR_encoding(INTERP, SELF, encoding);
             if (!STRING_IS_NULL(encoding)
             &&  Parrot_str_not_equal(INTERP, encoding, CONST_STRING(INTERP, "utf8")) == 0)
@@ -377,7 +380,7 @@
 */
 
     METHOD print(PMC *to_print) {
-        STRING *string_to_print = VTABLE_get_string(INTERP, to_print);
+        STRING * const string_to_print = VTABLE_get_string(INTERP, to_print);
 
         Parrot_io_putps(interp, SELF, string_to_print);
     }
@@ -427,9 +430,9 @@
 
     METHOD buffer_type(STRING *new_type :optional, INTVAL got_type :opt_flag) {
         INTVAL flags;
-        STRING *nobuffer_string   = Parrot_str_new_constant(INTERP, "unbuffered");
-        STRING *linebuffer_string = Parrot_str_new_constant(INTERP, "line-buffered");
-        STRING *fullbuffer_string = Parrot_str_new_constant(INTERP, "full-buffered");
+        STRING * const nobuffer_string   = Parrot_str_new_constant(INTERP, "unbuffered");
+        STRING * const linebuffer_string = Parrot_str_new_constant(INTERP, "line-buffered");
+        STRING * const fullbuffer_string = Parrot_str_new_constant(INTERP, "full-buffered");
 
         GET_ATTR_flags(INTERP, SELF, flags);
 


More information about the parrot-commits mailing list