argv_ref patch 26: allow NUL in macro definitions
Eric Blake <[email protected]>
| Newsgroups | gmane.comp.gnu.m4.patches |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Next in the series. The master branch already had most of the work done, thanks to hiding symbol definitions behind accessor methods, but branch-1.6 was using quite a bit of strlen. Macro definitions are now tracked by length rather than NUL termination, so that all 256 bytes are transparently supported in macro definitions. The branch is slightly faster due to expand_user_macro using memchr rather than bytewise searches for the next $ byte, but I didn't see a way to easily add that in the master branch without improving the syntax table to track whether only a single character is being used in the DOLLAR syntax category. No real change in memory usage. 2008-08-03 Eric Blake <[email protected]> Stage 26: Allow embedded NUL in macro definitions. Track macro definitions by length, to allow embedded NUL. Make arg_len callers aware of the issue of flattening builtins when determining length. Optimize loops that scan a definition. Memory impact: none. Speed impact: slight improvement, due to faster scans. * src/m4.h (set_word_regexp, arg_len, define_user_macro): Add parameters. (SYMBOL_TEXT_LEN): New macro. (ARG_LEN): Adjust callers. * src/builtin.c (define_user_macro): Add a parameter. (builtin_init, define_macro): Adjust callers. (m4_dumpdef, m4_defn, m4_changeword): Handle embedded NULs. (expand_user_macro): Handle embedded NUL, and speed up search for embedded $. * src/macro.c (arg_len): Add parameter. * src/input.c (set_word_regexp): Add parameter. (input_init): Adjust caller. * src/m4.c (main): Likewise. * src/freeze.c (dump_symbol_CB): Preserve NUL on freeze. (reload_frozen_state): Retrieve NUL on load. * doc/m4.texinfo (Builtin, Using frozen files): Enhance tests. * examples/null.m4: Likewise. * examples/null.out: Update expected output. * examples/null.err: 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 iEYEARECAAYFAkiWiHsACgkQ84KuGfSFAYCeUgCgmC8Ng06k+60OWpHvXEpbkw7T sVYAoLNU3LNSxdbjlR0Rp49IyyhL/7op =Fwv9 -----END PGP SIGNATURE----- _______________________________________________ M4-patches mailing list [email protected] http://lists.gnu.org/mailman/listinfo/m4-patches
m4.patch369
(text/plain, 36.2 KB) - not displayed