Stage 9: share rather than copy single-arg refs.
commite2b843f0aca9e296495f592e39d6a8cec69c6e8a
authorEric Blake <ebb9@byu.net>
Fri, 26 Oct 2007 15:24:06 +0000 (26 09:24 -0600)
committerEric Blake <ebb9@byu.net>
Fri, 21 Dec 2007 04:59:17 +0000 (20 21:59 -0700)
tree181f18c085665513e958c67671c811a23268a41c
parentc947bf47f48f9132155bc623596771e4a4e3f732
Stage 9: share rather than copy single-arg refs.

* m4/gnulib-cache.m4: Import quote and memmem modules.
* src/m4.h (arg_scratch): New prototype.
* src/input.c (INPUT_INLINE_THRESHOLD): New define.
(push_token): Use it to inline short text, and save references to
longer text.
(input_init, next_token): Simplify obstack handling.
* src/macro.c (expand_argument): Likewise.
(expand_macro): Track scratch space.
(arg_scratch): New function.
(make_argv_ref): Use it.
(push_args): Likewise, and simplify comma handling, since most
separators are short enough to be inlined.
* src/builtin.c (builtin_init): Avoid cast.
(m4_errprint, m4_index): Transparently support NUL.
(m4_translit): Use scratch space, rather than leaking memory on
expansion stack.
* doc/m4.texinfo (Syntax): Add new test of embedded NUL.
* checks/get-them: Extract test that uses external files.
* checks/check-them: Run the new test.  Use unified diff if
possible, and force text mode when debugging NUL handling.
* examples/null.m4: New file.
* examples/null.out: Likewise.
* examples/null.err: Likewise.
* examples/Makefile.am (EXTRA_FILES): Distribute these files.
* .gitattributes: Treat new files as text, in spite of embedded
NUL.

(cherry picked from commit a6c94a314afa34958330b719d66c2d4e403a94af)

Signed-off-by: Eric Blake <ebb9@byu.net>
14 files changed:
ChangeLog
checks/check-them
checks/get-them
doc/m4.texinfo
examples/.gitattributes [new file with mode: 0644]
examples/Makefile.am
examples/null.err [new file with mode: 0644]
examples/null.m4 [new file with mode: 0644]
examples/null.out [new file with mode: 0644]
m4/gnulib-cache.m4
src/builtin.c
src/input.c
src/m4.h
src/macro.c