regex handling
Change the regex_error_desc() interface. Have the caller pass in
a pointer to a buffer of at least BUFSZ characters and have
regex_error_desc() populate that. No need for static buffers or
extra dynamic alloction.
Also, change it to never return Null. None of its callers were
checking for that and could have passed Null to config_error_add()
or raw_print(). printf("%s", NULL) produces "null" on OSX but other
systems would probably crash if a Null result ever actually occurred.
The error explanation returned by cppregex included a trailing period.
config_error_add() adds one, so the message ended up with two. Have
regex_error_desc() check for final period and strip it off if found.
(My test case used a menucolor pattern of "[" which triggers an error
about mismatched brackets.)
Reformat cppregex.cpp; treat 'extern "C" {' as if it isn't introducing
a nested block. Fix the '#include <hack.h>' that 'make depend' was
ignoring.
This commit is contained in:
@@ -1829,7 +1829,7 @@ extern void nhl_pushhooked_open_table(lua_State *L);
|
||||
|
||||
extern struct nhregex *regex_init(void);
|
||||
extern boolean regex_compile(const char *, struct nhregex *);
|
||||
extern const char *regex_error_desc(struct nhregex *);
|
||||
extern char *regex_error_desc(struct nhregex *, char *);
|
||||
extern boolean regex_match(const char *, struct nhregex *);
|
||||
extern void regex_free(struct nhregex *);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user