diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2016-10-13 21:29:45 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2016-10-13 21:29:45 +0300 |
commit | 8b0d41a9bfe9e97c8580e40eb34c0a1889663b38 (patch) | |
tree | 52355fec714a5b5c5a464ff4263f407c6c9579ac | |
parent | 43a8120a00068448c4ffa60db37bdb8e782df321 (diff) | |
download | egawk-8b0d41a9bfe9e97c8580e40eb34c0a1889663b38.tar.gz egawk-8b0d41a9bfe9e97c8580e40eb34c0a1889663b38.tar.bz2 egawk-8b0d41a9bfe9e97c8580e40eb34c0a1889663b38.zip |
Sync dfa.c with GNULIB.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | dfa.c | 34 |
2 files changed, 38 insertions, 0 deletions
@@ -1,3 +1,7 @@ +2016-10-13 Arnold D. Robbins <arnold@skeeve.com> + + * dfa.c: Sync with GNULIB. + 2016-10-12 Arnold D. Robbins <arnold@skeeve.com> * awkgram.y (make_profile_number): Allocate an extra byte for the @@ -3131,6 +3131,39 @@ dfaexec_main (struct dfa *d, char const *begin, char *end, bool allow_nl, unsigned char saved_end; size_t nlcount = 0; + if (MAX_TRCOUNT <= d->sindex) + { + for (s = d->min_trcount; s < d->sindex; s++) + { + free (d->states[s].elems.elems); + free (d->states[s].mbps.elems); + } + d->sindex = d->min_trcount; + + if (d->trans) + { + for (s = 0; s < d->tralloc; s++) + { + free (d->trans[s]); + free (d->fails[s]); + d->trans[s] = d->fails[s] = NULL; + } + d->trcount = 0; + } + + if (d->localeinfo.multibyte && d->mb_trans) + { + for (s = -1; s < d->tralloc; s++) + { + free (d->mb_trans[s]); + d->mb_trans[s] = NULL; + } + for (s = 0; s < d->min_trcount; s++) + d->states[s].mb_trindex = -1; + d->mb_trcount = 0; + } + } + if (!d->tralloc) { realloc_trans_if_necessary (d, 1); @@ -3460,6 +3493,7 @@ dfassbuild (struct dfa *d) sup->tokens[j++] = EMPTY; break; } + /* fallthrough */ default: sup->tokens[j++] = d->tokens[i]; if ((0 <= d->tokens[i] && d->tokens[i] < NOTCHAR) |