*/
trie->states[ state ].trans.base=base;
}
- Renew( trie->trans, tp + 1, reg_trie_trans );
-
+ trie->lasttrans = tp + 1;
}
} else {
/*
}
}
}
- Renew( trie->trans, pos + 1, reg_trie_trans);
+ trie->lasttrans = pos + 1;
Renew( trie->states, laststate + 1, reg_trie_state);
DEBUG_TRIE_COMPILE_MORE_r(
PerlIO_printf( Perl_debug_log, " Alloc: %d Orig: %d elements, Final:%d. Savings of %%%5.2f\n",
} /* end table compress */
}
+ /* resize the trans array to remove unused space */
+ Renew( trie->trans, trie->lasttrans, reg_trie_trans);
DEBUG_TRIE_COMPILE_r({
U32 state;
}
}
PerlIO_printf( Perl_debug_log, "\n-----:-----------------------");
+
for( state = 0 ; state < trie->uniquecharcount ; state++ )
PerlIO_printf( Perl_debug_log, "-----");
PerlIO_printf( Perl_debug_log, "\n");
+
for( state = 1 ; state < trie->laststate ; state++ ) {
U32 base = trie->states[ state ].trans.base;
if ( base ) {
U32 ofs = 0;
- while( ( base + ofs - trie->uniquecharcount ) >=0 &&
- trie->trans[ base + ofs - trie->uniquecharcount ].check != state )
+ while( ( base + ofs < trie->uniquecharcount ) ||
+ ( base + ofs - trie->uniquecharcount < trie->lasttrans
+ && trie->trans[ base + ofs - trie->uniquecharcount ].check != state))
ofs++;
PerlIO_printf( Perl_debug_log, "+%02X[ ", ofs);
for ( ofs = 0 ; ofs < trie->uniquecharcount ; ofs++ ) {
- if ( ( base + ofs - trie->uniquecharcount>=0) &&
+ if ( ( base + ofs >= trie->uniquecharcount ) &&
+ ( base + ofs - trie->uniquecharcount < trie->lasttrans ) &&
trie->trans[ base + ofs - trie->uniquecharcount ].check == state )
{
PerlIO_printf( Perl_debug_log, "%04X ",
} \
} \
if ( charid && \
- ( base + charid - 1 - trie->uniquecharcount ) >=0 && \
+ ( base + charid > trie->uniquecharcount ) && \
+ ( base + charid - 1 - trie->uniquecharcount < trie->lasttrans) && \
trie->trans[ base + charid - 1 - trie->uniquecharcount ].check == state ) \
{ \
state = trie->trans[ base + charid - 1 - trie->uniquecharcount ].next; \
tmp ? SvPV_nolen( *tmp ) : "not compiled under -Dr",
PL_colors[5] );
});
- PL_reginput = accept_buff[ 0 ].endpos;
+ PL_reginput = (char *)accept_buff[ 0 ].endpos;
/* in this case we free tmps/leave before we call regmatch
as we wont be using accept_buff again. */
FREETMPS;
accept_buff[ accepted ] = tmp;
best = accepted;
}
- PL_reginput = accept_buff[ best ].endpos;
+ PL_reginput = (char *)accept_buff[ best ].endpos;
/*
as far as I can tell we only need the SAVETMPS/FREETMPS