=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/awk/b.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -r1.43 -r1.44 --- src/usr.bin/awk/b.c 2023/10/06 22:29:24 1.43 +++ src/usr.bin/awk/b.c 2023/10/06 22:31:21 1.44 @@ -1,4 +1,4 @@ -/* $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 @@ -116,6 +116,7 @@ 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 * @@ -276,8 +277,7 @@ } 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 */ @@ -613,6 +613,11 @@ 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; @@ -1492,8 +1497,6 @@ /* 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__);