argv_ref patch 27: allow NUL through more builtins
Eric Blake <[email protected]>
| Newsgroups | gmane.comp.gnu.m4.patches |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 It's been a while since I've worked on porting the argv_ref branch to master, but I finally got one done. This fixes regular expressions, format, and translit to transparently handle NUL; mostly a matter of passing lengths around rather than NUL-termination (thank heavens that glibc, and thus gnulib, already provide a regex interface that handles NUL). No big change in speed or memory usage. And as long as I was editing format, I made it better able to detect excess or missing arguments. Meanwhile, I didn't see a way to use NUL in eval, so that now warns. Stage 27: Allow embedded NUL in text processing macros. Pass NUL through regular expressions, format, and translit, and diagnose it in eval. Improve warning capabilities of format. Memory impact: none. Speed impact: none noticed. * src/m4.h (evaluate): Add parameter. * src/builtin.c (compile_pattern) [DEBUG_REGEX]: Support NUL in output messages. (set_macro_sequence): Likewise. (m4_eval): Normalize messages, and adjust caller. (expand_ranges, substitute): Support NUL in macro expansion. (m4_translit, m4_regexp, m4_patsubst): Adjust callers, to manage NUL bytes. * src/format.c (expand_format): Manage NUL bytes. * src/eval.c (eval_error): Add EMPTY_ARGUMENT. (end_text): New variable. (eval_init_lex): Add parameter. (eval_lex, evaluate): Detect NUL in macro expansion. * doc/m4.texinfo (Format): Update to cover new behavior. (Eval): Mention that result is unquoted. * examples/null.m4: Enhance test. * examples/null.err: Update expected output. * examples/null.out: Likewise. - -- Don't work too hard, make some time for fun as well! Eric Blake [email protected] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Cygwin) Comment: Public key at home.comcast.net/~ericblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkk3XKEACgkQ84KuGfSFAYCAvACeMDWbgh+2qAadcmFkWGzTUh83 RfkAoKzg1pjjyqRPgXeD6fvTEqXbvi1V =8FT2 -----END PGP SIGNATURE----- _______________________________________________ M4-patches mailing list [email protected] http://lists.gnu.org/mailman/listinfo/m4-patches
m4.patch385
(text/plain, 59.7 KB) - not displayed