-/* $OpenBSD: b.c,v 1.43 2023/10/06 22:29:24 millert Exp $ */
+/* $OpenBSD: b.c,v 1.44 2023/10/06 22:31:21 millert Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
static int get_gototab(fa*, int, int);
static int set_gototab(fa*, int, int, int);
+static void reset_gototab(fa*, int);
extern int u8_rune(int *, const uschar *);
static int *
}
if ((f->posns[2])[1] == f->accept)
f->out[2] = 1;
- for (i = 0; i < NCHARS; i++)
- set_gototab(f, 2, 0, 0); /* f->gototab[2][i] = 0; */
+ reset_gototab(f, 2);
f->curstat = cgoto(f, 2, HAT);
if (anchor) {
*f->posns[2] = k-1; /* leave out position 0 */
return 0;
}
+static void reset_gototab(fa *f, int state) /* hide gototab inplementation */
+{
+ memset(f->gototab[state], 0, f->gototab_len * sizeof(**f->gototab));
+}
+
static int set_gototab(fa *f, int state, int ch, int val) /* hide gototab inplementation */
{
int i;
/* add tmpset to current set of states */
++(f->curstat);
resize_state(f, f->curstat);
- for (i = 0; i < NCHARS; i++)
- set_gototab(f, f->curstat, 0, 0);
xfree(f->posns[f->curstat]);
p = intalloc(setcnt + 1, __func__);