From: Paul Eggert Date: Wed, 11 Dec 2019 21:40:01 +0000 (-0800) Subject: dfa: update commentary for previous change X-Git-Tag: v1.0~4525 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=360cbd3b17a314807e808626e100ef47dcf4d162;p=gnulib.git dfa: update commentary for previous change * NEWS: Mention the change. * lib/dfa.c, lib/dfa.h (dfaparse, dfamust, dfacomp): Update comments. --- diff --git a/ChangeLog b/ChangeLog index f80f33b385..bc912c771b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2019-12-11 Paul Eggert + + dfa: update commentary for previous change + * NEWS: Mention the change. + * lib/dfa.c, lib/dfa.h (dfaparse, dfamust, dfacomp): Update comments. + 2019-12-11 Norihiro Tanaka dfa: separate parse and compile phase diff --git a/NEWS b/NEWS index 8085c353e6..b73c9088ad 100644 --- a/NEWS +++ b/NEWS @@ -58,6 +58,10 @@ User visible incompatible changes Date Modules Changes +2019-12-11 dfa To call dfamust, one must now call dfaparse + without yet calling dfacomp. This fixes a bug + introduced on 2018-10-22 that broke dfamust. + 2019-12-07 xstrtol This module no longer defines the function xstrtoll 'xstrtol_fatal'. Program that need this function xstrtoimax should add the module 'xstrtol-error' to the list diff --git a/lib/dfa.c b/lib/dfa.c index 1e125b4d24..2347a91c13 100644 --- a/lib/dfa.c +++ b/lib/dfa.c @@ -1966,9 +1966,8 @@ regexp (struct dfa *dfa) } } -/* Main entry point for the parser. S is a string to be parsed, len is the - length of the string, so s can include NUL characters. D is a pointer to - the struct dfa to parse into. */ +/* Parse a string S of length LEN into D. S can include NUL characters. + This is the main entry point for the parser. */ void dfaparse (char const *s, size_t len, struct dfa *d) { @@ -3741,7 +3740,9 @@ dfassbuild (struct dfa *d) } } -/* Parse and analyze a single string of the given length. */ +/* Parse a string S of length LEN into D (but skip this step if S is null). + Then analyze D and build a matcher for it. + SEARCHFLAG says whether to build a searching or an exact matcher. */ void dfacomp (char const *s, size_t len, struct dfa *d, bool searchflag) { diff --git a/lib/dfa.h b/lib/dfa.h index 221f7d172a..bf87703e8b 100644 --- a/lib/dfa.h +++ b/lib/dfa.h @@ -65,18 +65,20 @@ enum extern void dfasyntax (struct dfa *, struct localeinfo const *, reg_syntax_t, int); -/* Build and return the struct dfamust from the given struct dfa. */ +/* Parse the given string of given length into the given struct dfa. */ +extern void dfaparse (char const *, size_t, struct dfa *); + +/* Allocate and return a struct dfamust from a struct dfa that was + initialized by dfaparse and not yet given to dfacomp. */ extern struct dfamust *dfamust (struct dfa const *); /* Free the storage held by the components of a struct dfamust. */ extern void dfamustfree (struct dfamust *); -/* Parse the given string of given length into the given struct dfa. */ -extern void dfaparse (char const *, size_t, struct dfa *); - /* Compile the given string of the given length into the given struct dfa. - Final argument is a flag specifying whether to build a searching or an - exact matcher. */ + The last argument says whether to build a searching or an exact matcher. + A null first argument means the struct dfa has already been + initialized by dfaparse; the second argument is ignored. */ extern void dfacomp (char const *, size_t, struct dfa *, bool); /* Search through a buffer looking for a match to the given struct dfa.