diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2018-09-26 16:26:25 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2018-09-26 16:26:25 +0300 |
commit | c25c88f583c984112055fa091d357c1b8538d5d8 (patch) | |
tree | a971b8150c89a3f00e816c14bfc6cacb2f96c1d4 /re.c | |
parent | 26b1a15e75cc1d134e8b52b0df9a5d1365e66d8f (diff) | |
download | egawk-c25c88f583c984112055fa091d357c1b8538d5d8.tar.gz egawk-c25c88f583c984112055fa091d357c1b8538d5d8.tar.bz2 egawk-c25c88f583c984112055fa091d357c1b8538d5d8.zip |
Add more lint warnings.
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -51,6 +51,12 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal) static bool no_dfa = false; int i; static struct dfa* dfaregs[2] = { NULL, NULL }; + static bool nul_warned = false; + + if (do_lint && ! nul_warned && memchr(s, '\0', len) != NULL) { + nul_warned = true; + lintwarn(_("behavior of matching a regexp containing NUL characters is not defined by POSIX")); + } /* * The number of bytes in the current multibyte character. @@ -148,6 +154,12 @@ make_regexp(const char *s, size_t len, bool ignorecase, bool dfa, bool canfatal) && strchr("()|*+?.^$\\[]", c2) != NULL) *dest++ = '\\'; *dest++ = (char) c2; + if (do_lint + && ! nul_warned + && c2 == '\0') { + nul_warned = true; + lintwarn(_("behavior of matching a regexp containing NUL characters is not defined by POSIX")); + } break; case '8': case '9': /* a\9b not valid */ |