summaryrefslogtreecommitdiff
path: root/m4/symtab.c
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2007-12-20 10:56:29 -0700
committerEric Blake <ebb9@byu.net>2007-12-20 14:46:08 -0700
commite38bf1ca50e3c5038fab27266ecb3ce3d1a0296f (patch)
treeb6b490db3c71a43267b5b1ff3deaaae920aa0acd /m4/symtab.c
parentfa34c3f77687fac1d5264955e11a7c704a89e875 (diff)
downloadm4-e38bf1ca50e3c5038fab27266ecb3ce3d1a0296f.tar.gz
Stage 9: share rather than copy single-arg refs.
* ltdl/m4/gnulib-cache.m4: Import memmem and quote modules. * m4/m4module.h (m4_arg_scratch): New prototype. * m4/m4private.h (m4__push_symbol): Add parameter. (m4_arg_scratch): Add fast accessor. (struct m4): Add expansion_level member, taken... * m4/macro.c (expansion_level): ...from here. Adjust all users. (expand_argument): Minor cleanup. (expand_macro): Track scratch space per macro call. (m4_arg_scratch): New function. (m4_make_argv_ref): Call new function. (m4_push_arg): Push reference to $0. (m4_push_args): Rework separator usage, since separators will usually be inlined. (process_macro): Allow embedded NUL. * m4/input.c (INPUT_INLINE_THRESHOLD): New define. (m4__push_symbol): Add parameter. Inline short strings, and save references through rescanning. * m4/symtab.c (m4_set_symbol_value_text): Weaken assertion. * modules/m4.c (errprint, index): Handle NUL transparently. (dumpdef, translit): Use scratch space, rather than expansion stack. * modules/gnu.c (renamesyms, m4symbols): Likewise. * tests/others.at (nul character): New test. (iso8859): Quote absolute file name, remove XFAIL. * tests/iso8859.m4: Avoid raw NUL in output. * tests/null.m4: New file. * tests/null.out: Likewise. * tests/null.err: Likewise. * Makefile.am (OTHER_FILES): Distribute new files. * .gitattributes: Treat new files as text. Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'm4/symtab.c')
-rw-r--r--m4/symtab.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/m4/symtab.c b/m4/symtab.c
index 95ed36ed..30a61eda 100644
--- a/m4/symtab.c
+++ b/m4/symtab.c
@@ -701,12 +701,9 @@ m4_set_symbol_value_text (m4_symbol_value *value, const char *text, size_t len,
unsigned int quote_age)
{
assert (value && text);
- /* TODO - this assertion enforces NUL-terminated text with no
- intermediate NULs. Do we want to optimize memory usage and use
- purely length-based manipulation, for one less byte per string?
- Perhaps only without NDEBUG? Also, do we want to support
- embedded NUL? */
- assert (strlen (text) == len);
+ /* In practice, it is easier to debug when we guarantee a
+ terminating NUL, even when there are embedded NULs. */
+ assert (!text[len]);
value->type = M4_SYMBOL_TEXT;
value->u.u_t.text = text;