[svn:parrot] r37074 - trunk/src

cotto at svn.parrot.org cotto at svn.parrot.org
Mon Mar 2 12:04:56 UTC 2009


Author: cotto
Date: Mon Mar  2 12:04:56 2009
New Revision: 37074
URL: https://trac.parrot.org/parrot/changeset/37074

Log:
[PMC] fix an old uncaught mistake in PackFile_find_in_const, minor refactor

Modified:
   trunk/src/packout.c

Modified: trunk/src/packout.c
==============================================================================
--- trunk/src/packout.c	Mon Mar  2 10:56:18 2009	(r37073)
+++ trunk/src/packout.c	Mon Mar  2 12:04:56 2009	(r37074)
@@ -218,14 +218,17 @@
         ARGIN(const PackFile_ConstTable *ct), ARGIN(PMC *key), int type)
 {
     ASSERT_ARGS(PackFile_find_in_const)
-    int i;
-    STRING *s;
+    int      i;
+    FLOATVAL key_num;
+    STRING  *key_str;
+
+    GETATTR_Key_str_key(interp, key, key_str);
+    GETATTR_Key_num_key(interp, key, key_num);
+
     for (i = 0; i < ct->const_count; i++) {
-        GETATTR_Key_str_key(interp, key, s);
-        if (type == PFC_STRING && ct->constants[i]->u.string == s)
+        if (type == PFC_STRING && ct->constants[i]->u.string == key_str)
             return i;
-        else if (type == PFC_NUMBER && ct->constants[i]->u.number ==
-                 VTABLE_get_integer(interp, key))
+        if (type == PFC_NUMBER && ct->constants[i]->u.number == key_num)
             return i;
     }
     Parrot_io_eprintf(NULL, "find_in_const: couldn't find const for key\n");


More information about the parrot-commits mailing list