[svn:parrot] r46016 - in trunk: compilers/imcc src/packfile

chromatic at svn.parrot.org chromatic at svn.parrot.org
Mon Apr 26 00:24:19 UTC 2010


Author: chromatic
Date: Mon Apr 26 00:24:18 2010
New Revision: 46016
URL: https://trac.parrot.org/parrot/changeset/46016

Log:
[PBC] Tidied code; no functional changes.

Modified:
   trunk/compilers/imcc/pbc.c
   trunk/src/packfile/pf_items.c

Modified: trunk/compilers/imcc/pbc.c
==============================================================================
--- trunk/compilers/imcc/pbc.c	Mon Apr 26 00:24:10 2010	(r46015)
+++ trunk/compilers/imcc/pbc.c	Mon Apr 26 00:24:18 2010	(r46016)
@@ -983,31 +983,32 @@
     ASSERT_ARGS(add_const_str)
 
     PackFile_ConstTable *table = interp->code->const_table;
-    STRING * const s = IMCC_string_from_reg(interp, r);
-    int k = -1;
+    STRING * const       s     = IMCC_string_from_reg(interp, r);
     int i;
+
     for (i = 0; i < table->const_count; ++i) {
         PackFile_Constant * const constant = table->constants[i];
         if (constant->type == PFC_STRING) {
             STRING * const sc = constant->u.string;
-            if (Parrot_charset_number_of_str(interp, s) ==
-                    Parrot_charset_number_of_str(interp, sc) &&
-                    Parrot_encoding_number_of_str(interp, s) ==
-                    Parrot_encoding_number_of_str(interp, sc) &&
-                    Parrot_str_equal(interp, s, sc)) {
-                k = i;
-                break;
+            if (Parrot_charset_number_of_str(interp, s)
+            ==  Parrot_charset_number_of_str(interp, sc)
+            &&  Parrot_encoding_number_of_str(interp, s)
+            ==  Parrot_encoding_number_of_str(interp, sc)
+            &&  Parrot_str_equal(interp, s, sc)) {
+                return i;
             }
         }
     }
-    if (k < 0) {
-        PackFile_Constant * constant;
-        k = add_const_table(interp);
-        constant = table->constants[k];
-        constant->type     = PFC_STRING;
-        constant->u.string = s;
+
+    /* otherwise... */
+    {
+        int                k        = add_const_table(interp);
+        PackFile_Constant *constant = table->constants[k];
+        constant->type              = PFC_STRING;
+        constant->u.string          = s;
+
+        return k;
     }
-    return k;
 }
 
 

Modified: trunk/src/packfile/pf_items.c
==============================================================================
--- trunk/src/packfile/pf_items.c	Mon Apr 26 00:24:10 2010	(r46015)
+++ trunk/src/packfile/pf_items.c	Mon Apr 26 00:24:18 2010	(r46016)
@@ -1307,17 +1307,14 @@
 {
     ASSERT_ARGS(PF_fetch_string)
     STRING   *s;
-    opcode_t  flag_charset_word;
     UINTVAL   flags;
     UINTVAL   charset_nr;
     size_t    size;
-    const int wordsize = pf ? pf->header->wordsize : sizeof (opcode_t);
+    const int wordsize          = pf ? pf->header->wordsize : sizeof (opcode_t);
+    opcode_t  flag_charset_word = PF_fetch_opcode(pf, cursor);
 
-    flag_charset_word = PF_fetch_opcode(pf, cursor);
-
-    if (flag_charset_word == -1) {
+    if (flag_charset_word == -1)
         return STRINGNULL;
-    }
 
     /* decode flags and charset */
     flags         = (flag_charset_word & 0x1 ? PObj_constant_FLAG : 0) |


More information about the parrot-commits mailing list