u = tre_mem_calloc(mem, sizeof(tre_last_matched_pre_t) +
sizeof(tre_last_matched_branch_pre_t)
- + bitstr_size(num_tags));
+ + bitstr_size(tnfa->num_tags));
if (!u)
{
status = REG_ESPACE;
node = tre_stack_pop_voidptr(stack);
start_tag = tre_stack_pop_int(stack);
b = tre_mem_calloc(mem, sizeof(tre_last_matched_branch_pre_t)
- + bitstr_size(num_tags));
+ + bitstr_size(tnfa->num_tags));
if (!b)
{
status = REG_ESPACE;
if (errcode != REG_OK)
ERROR_EXIT(errcode);
+#ifdef USE_FIRSTPOS_CHARS /* not defined */
/* If in eight bit mode, compute a table of characters that can be the
first character of a match. */
tnfa->first_char = -1;
}
else
tnfa->firstpos_chars = NULL;
+#else /* !USE_FIRSTPOS_CHARS */
+ /* Set first_char only if there is only one character that can be the
+ first character of a match */
+ tnfa->first_char = -1;
+ if (!tmp_ast_l->nullable)
+ {
+ int scanning = 1;
+ for (p = tree->firstpos; scanning && p->position >= 0; p++)
+ {
+ tre_tnfa_transition_t *j = transitions + offs[p->position];
+ while (j->state != NULL)
+ {
+ if (j->code_min <= j->code_max)
+ {
+ if (j->code_max != j->code_min || j->code_min == -1 || tnfa->first_char != -1)
+ {
+ tnfa->first_char = -1;
+ scanning = 0;
+ break;
+ }
+ tnfa->first_char = j->code_min;
+ }
+ j++;
+ }
+ }
+#ifdef TRE_DEBUG
+ if (tnfa->first_char >= 0)
+ DPRINT(("first char must be %d\n", tnfa->first_char));
+#endif /* TRE_DEBUG */
+ }
+#endif /* !USE_FIRSTPOS_CHARS */
p = tree->firstpos;
i = 0;
if (tnfa->tag_directions)
xfree(tnfa->tag_directions);
+#ifdef USE_FIRSTPOS_CHARS /* not defined */
if (tnfa->firstpos_chars)
xfree(tnfa->firstpos_chars);
+#endif /* USE_FIRSTPOS_CHARS */
if (tnfa->minimal_tags)
xfree(tnfa->minimal_tags);