summaryrefslogtreecommitdiff
path: root/modules/gnu.c
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2007-12-08 21:05:11 -0700
committerEric Blake <ebb9@byu.net>2007-12-08 21:05:11 -0700
commita9d31f373b211f8790ee4b79c5e85943bf9fab9e (patch)
treed09273db2f2e70d459724c2720063c5609c0e4fd /modules/gnu.c
parentb8122b55893c4f55a4a64d65744ee78b67b5b6a5 (diff)
downloadm4-a9d31f373b211f8790ee4b79c5e85943bf9fab9e.tar.gz
Stage 6: convert builtins to push arg at a time.
* m4/m4module.h (m4_shipout_text): Rename... (m4_divert_text): ...to this, to avoid confusion with m4_shipout_* that does not worry about sync lines. (m4_shipout_string_trunc): New prototype. * m4/output.c (m4_shipout_text): Rename... (m4_divert_text): ...to this. (m4_shipout_string): Move guts... (m4_shipout_string_trunc): ...to this new function. * m4/macro.c (m4_push_arg, m4_push_args): New functions. (expand_token, process_macro): Update callers. * m4/input.c (string_print): Likewise. * modules/m4.c (ifdef, ifelse, shift, substr, translit, divert): Likewise. * modules/gnu.c (patsubst): Likewise. (debuglen): Use SIZE_MAX for unlimited debug length. * src/main.c (main): Likewise. * m4/m4.c (m4_create): Default max_debug_length to SIZE_MAX, not zero. Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'modules/gnu.c')
-rw-r--r--modules/gnu.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/gnu.c b/modules/gnu.c
index 3c772c56..7205727d 100644
--- a/modules/gnu.c
+++ b/modules/gnu.c
@@ -557,11 +557,13 @@ M4BUILTIN_HANDLER (debugfile)
M4BUILTIN_HANDLER (debuglen)
{
int i;
+ size_t s;
if (!m4_numeric_arg (context, M4ARG (0), M4ARG (1), &i))
return;
/* FIXME - make m4_numeric_arg more powerful - we want to accept
suffixes, and limit the result to size_t. */
- m4_set_max_debug_arg_length_opt (context, i);
+ s = i <= 0 ? SIZE_MAX : i;
+ m4_set_max_debug_arg_length_opt (context, s);
}
/* On-the-fly control of the format of the tracing output. It takes one
@@ -739,7 +741,7 @@ M4BUILTIN_HANDLER (patsubst)
replacement, we need not waste time with it. */
if (!*pattern && !*replace)
{
- obstack_grow (obs, M4ARG (1), m4_arg_len (argv, 1));
+ m4_push_arg (context, obs, argv, 1);
return;
}