summaryrefslogtreecommitdiff
path: root/m4/symtab.c
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2007-12-11 09:36:08 -0700
committerEric Blake <ebb9@byu.net>2007-12-11 19:13:26 -0700
commit8f276ee65769eae767a638b98d354fe1c3b2700d (patch)
tree8c0a3715513ab73ecae54a0b8184c8e707bb6c6c /m4/symtab.c
parenta9d31f373b211f8790ee4b79c5e85943bf9fab9e (diff)
downloadm4-8f276ee65769eae767a638b98d354fe1c3b2700d.tar.gz
Stage 7: use chained input support in input parser.
* m4/m4private.h (m4__push_symbol): New prototype. (struct m4_symbol_chain): Add const-safety. * m4/symtab.c (m4_symbol_value_print): Simplify. (dump_symbol_CB): Update caller. * m4/input.c (struct m4_input_block): Alter u_c member, first introduced 2006-10-25, but unused until now. (composite_peek, composite_read, composite_unget) (composite_print, init_builtin_token): Rewrite accordingly. (m4_push_wrapup): No longer need trailing NUL. (m4__push_symbol, make_text_link): New functions. (m4_push_string_finish): Use them. * m4/macro.c (m4_push_arg, m4_push_args): Likewise. (expand_macro): Simplify logic of nesting_limit. * src/main.c (main): Likewise. * doc/m4.texinfo (Dumpdef): Augment test. Signed-off-by: Eric Blake <ebb9@byu.net>
Diffstat (limited to 'm4/symtab.c')
-rw-r--r--m4/symtab.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/m4/symtab.c b/m4/symtab.c
index 932a31fa..95ed36ed 100644
--- a/m4/symtab.c
+++ b/m4/symtab.c
@@ -476,13 +476,13 @@ m4_set_symbol_name_traced (m4_symbol_table *symtab, const char *name,
}
/* Grow OBS with a text representation of VALUE. If QUOTE, then
- surround a text definition by LQUOTE and RQUOTE. If ARG_LENGTH is
- non-zero, then truncate text definitions to that length. If
+ surround a text definition by LQUOTE and RQUOTE. If MAXLEN is less
+ than SIZE_MAX, then truncate text definitions to that length. If
MODULE, then include which module defined a builtin. */
void
m4_symbol_value_print (m4_symbol_value *value, m4_obstack *obs, bool quote,
- const char *lquote, const char *rquote,
- size_t arg_length, bool module)
+ const char *lquote, const char *rquote, size_t maxlen,
+ bool module)
{
const char *text;
size_t len;
@@ -492,9 +492,9 @@ m4_symbol_value_print (m4_symbol_value *value, m4_obstack *obs, bool quote,
{
text = m4_get_symbol_value_text (value);
len = m4_get_symbol_value_len (value);
- if (arg_length && arg_length < len)
+ if (maxlen < len)
{
- len = arg_length;
+ len = maxlen;
truncated = true;
}
}
@@ -541,8 +541,8 @@ m4_symbol_value_print (m4_symbol_value *value, m4_obstack *obs, bool quote,
/* Grow OBS with a text representation of SYMBOL. If QUOTE, then
surround each text definition by LQUOTE and RQUOTE. If STACK, then
append all pushdef'd values, rather than just the top. If
- ARG_LENGTH is non-zero, then truncate text definitions to that
- length. If MODULE, then include which module defined a
+ ARG_LENGTH is less than SIZE_MAX, then truncate text definitions to
+ that length. If MODULE, then include which module defined a
builtin. */
void
m4_symbol_print (m4_symbol *symbol, m4_obstack *obs, bool quote,
@@ -698,7 +698,7 @@ m4_get_symbol_value_placeholder (m4_symbol_value *value)
#undef m4_set_symbol_value_text
void
m4_set_symbol_value_text (m4_symbol_value *value, const char *text, size_t len,
- unsigned int quote_age)
+ unsigned int quote_age)
{
assert (value && text);
/* TODO - this assertion enforces NUL-terminated text with no
@@ -768,7 +768,7 @@ dump_symbol_CB (m4_symbol_table *symtab, const char *name,
{
m4_obstack obs;
obstack_init (&obs);
- m4_symbol_value_print (value, &obs, false, NULL, NULL, 0, true);
+ m4_symbol_value_print (value, &obs, false, NULL, NULL, SIZE_MAX, true);
xfprintf (stderr, "%s", (char *) obstack_finish (&obs));
obstack_free (&obs, NULL);
}