[svn:parrot] r36424 - in trunk/src: . pmc

petdance at svn.parrot.org petdance at svn.parrot.org
Sat Feb 7 23:00:16 UTC 2009


Author: petdance
Date: Sat Feb  7 23:00:15 2009
New Revision: 36424
URL: https://trac.parrot.org/parrot/changeset/36424

Log:
consting and removing unused vars

Modified:
   trunk/src/exec_save.c
   trunk/src/library.c
   trunk/src/pmc/class.pmc

Modified: trunk/src/exec_save.c
==============================================================================
--- trunk/src/exec_save.c	Sat Feb  7 22:58:54 2009	(r36423)
+++ trunk/src/exec_save.c	Sat Feb  7 23:00:15 2009	(r36424)
@@ -49,7 +49,7 @@
 void
 Parrot_exec_save(PARROT_INTERP, Parrot_exec_objfile_t *obj, const char *file)
 {
-    FILE * fp = fopen(file, "w");
+    FILE * const fp = fopen(file, "w");
     int    i;
     struct exec header;
     struct relocation_info rellocation;

Modified: trunk/src/library.c
==============================================================================
--- trunk/src/library.c	Sat Feb  7 22:58:54 2009	(r36423)
+++ trunk/src/library.c	Sat Feb  7 23:00:15 2009	(r36424)
@@ -517,7 +517,6 @@
     STRING * const bytecode_extension = CONST_STRING(interp, ".pbc");
     STRING * const pir_extension      = CONST_STRING(interp, ".pir");
     STRING * const pasm_extension     = CONST_STRING(interp, ".pasm");
-    int guess;
 
     test_path = Parrot_str_copy(interp, path);
 
@@ -538,7 +537,7 @@
             STRING *orig_ext = Parrot_str_substr(interp, test_path, -4, 4, NULL, 0);
             /* First try substituting .pbc for the .pir extension */
             if (Parrot_str_not_equal(interp, orig_ext, pir_extension) == 0) {
-                STRING *without_ext = Parrot_str_chopn(interp, test_path, 4);
+                STRING * const without_ext = Parrot_str_chopn(interp, test_path, 4);
                 test_path = Parrot_str_append(interp, without_ext, bytecode_extension);
                 result = try_load_path(interp, test_path);
                 if (result)
@@ -546,7 +545,7 @@
             }
             /* Next try substituting .pir, then .pasm for the .pbc extension */
             else if (Parrot_str_not_equal(interp, orig_ext, bytecode_extension) == 0) {
-                STRING *without_ext = Parrot_str_chopn(interp, test_path, 4);
+                STRING * const without_ext = Parrot_str_chopn(interp, test_path, 4);
                 test_path = Parrot_str_append(interp, without_ext, pir_extension);
                 result = try_load_path(interp, test_path);
                 if (result)
@@ -562,9 +561,9 @@
 
         /* Finally, try substituting .pbc for the .pasm extension. */
         if (Parrot_str_byte_length(interp, test_path) > 5) {
-            STRING *orig_ext = Parrot_str_substr(interp, test_path, -5, 5, NULL, 0);
+            STRING * const orig_ext = Parrot_str_substr(interp, test_path, -5, 5, NULL, 0);
             if (Parrot_str_not_equal(interp, orig_ext, pasm_extension) == 0) {
-                STRING *without_ext = Parrot_str_chopn(interp, test_path, 5);
+                STRING * const without_ext = Parrot_str_chopn(interp, test_path, 5);
                 test_path = Parrot_str_append(interp, without_ext, bytecode_extension);
                 result = try_load_path(interp, test_path);
                 if (result)
@@ -599,7 +598,7 @@
     PMC * const iglobals = interp->iglobals;
     PMC * const lib_paths = VTABLE_get_pmc_keyed_int(interp, iglobals,
         IGLOBALS_LIB_PATHS);
-    PMC * paths = VTABLE_get_pmc_keyed_int(interp, lib_paths, which);
+    PMC * const paths = VTABLE_get_pmc_keyed_int(interp, lib_paths, which);
     STRING * const path_str = Parrot_str_new(interp, path, 0);
     VTABLE_push_string(interp, paths, path_str);
 }

Modified: trunk/src/pmc/class.pmc
==============================================================================
--- trunk/src/pmc/class.pmc	Sat Feb  7 22:58:54 2009	(r36423)
+++ trunk/src/pmc/class.pmc	Sat Feb  7 23:00:15 2009	(r36424)
@@ -479,7 +479,7 @@
     }
 
     VTABLE void init_pmc(PMC *init_data) {
-        PMC           *arg, *ns_name;
+        PMC           *arg;
         const INTVAL   arg_type = VTABLE_type(interp, init_data);
         STRING * const name_str = CONST_STRING(interp, "name");
 
@@ -1149,7 +1149,6 @@
 
     VTABLE PMC *instantiate(PMC *init) {
         Parrot_Class_attributes  * const _class    = PARROT_CLASS(SELF);
-        STRING                   * const class_str = CONST_STRING(interp, "Class");
 
         Parrot_Object_attributes *obj_guts;
         PMC                      *object;
@@ -1158,7 +1157,7 @@
         if (!_class->instantiated) {
             /* Check that we have all methods listed in resolve list. */
             const int resolve_count = VTABLE_elements(interp, _class->resolve_method);
-            INTVAL    cur_hll       = CONTEXT(interp)->current_HLL;
+            const INTVAL cur_hll    = CONTEXT(interp)->current_HLL;
             INTVAL    mro_length;
             int       i;
 
@@ -1325,8 +1324,7 @@
 */
 
     VTABLE INTVAL isa(STRING *classname) {
-        Parrot_Class_attributes * const _class = PARROT_CLASS(SELF);
-        PMC                            *want_class;
+        PMC *want_class;
 
         /* hard-code this one exception right away */
         if (Parrot_str_not_equal(interp, classname, CONST_STRING(interp, "Class")) == 0)


More information about the parrot-commits mailing list