From 83e9cc897cd081aba38adecce46db2b6ed49b669 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 17 Dec 2019 00:20:53 -0800 Subject: dfa: new function dfacopysyntax * lib/dfa.c (struct dfa): Move syntax member later so that dfacopysyntax can easily clear earlier members. (dfacopysyntax): New function, used by Gawk. --- lib/dfa.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/dfa.h') diff --git a/lib/dfa.h b/lib/dfa.h index 09e7991bda..0da597fc9f 100644 --- a/lib/dfa.h +++ b/lib/dfa.h @@ -45,6 +45,7 @@ struct dfa; /* Entry points. */ /* Allocate a struct dfa. The struct dfa is completely opaque. + It should be initialized via dfasyntax or dfacopysyntax before other use. The returned pointer should be passed directly to free() after calling dfafree() on it. */ extern struct dfa *dfaalloc (void) _GL_ATTRIBUTE_MALLOC; @@ -61,8 +62,7 @@ enum DFA_EOL_NUL = 1 << 1 }; -/* Initialize or reinitialize a DFA. This must be called before - any of the routines below. The arguments are: +/* Initialize or reinitialize a DFA. The arguments are: 1. The DFA to operate on. 2. Information about the current locale. 3. Syntax bits described in regex.h. @@ -70,6 +70,9 @@ enum extern void dfasyntax (struct dfa *, struct localeinfo const *, reg_syntax_t, int); +/* Initialize or reinitialize a DFA from an already-initialized DFA. */ +extern void dfacopysyntax (struct dfa *, struct dfa const *); + /* Parse the given string of given length into the given struct dfa. */ extern void dfaparse (char const *, ptrdiff_t, struct dfa *); -- cgit v1.2.1