[svn:parrot] r46379 - trunk/compilers/imcc
plobsing at svn.parrot.org
plobsing at svn.parrot.org
Fri May 7 03:09:53 UTC 2010
Author: plobsing
Date: Fri May 7 03:09:53 2010
New Revision: 46379
URL: https://trac.parrot.org/parrot/changeset/46379
Log:
consolidate functionality into PackFile_ConstTable_rlookup()
Modified:
trunk/compilers/imcc/pbc.c
Modified: trunk/compilers/imcc/pbc.c
==============================================================================
--- trunk/compilers/imcc/pbc.c Fri May 7 02:52:07 2010 (r46378)
+++ trunk/compilers/imcc/pbc.c Fri May 7 03:09:53 2010 (r46379)
@@ -983,23 +983,13 @@
{
ASSERT_ARGS(add_const_str)
+ PMC *s_pmc = key_new_string(interp, s);
PackFile_ConstTable *table = interp->code->const_table;
- int i;
+ int i = PackFile_ConstTable_rlookup(interp, table, s_pmc, PFC_STRING);
+
+ if (i >= 0)
+ return 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_str_equal(interp, s, sc)
- && 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))
- {
- return i;
- }
- }
- }
/* otherwise... */
{
More information about the parrot-commits
mailing list