[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
a type fix, obstack_print
From: |
Ralf Wildenhues |
Subject: |
a type fix, obstack_print |
Date: |
Sat, 23 Feb 2008 11:17:07 +0100 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Hi Eric,
FWIW, I think the use of different integer types for lenghts looks a bit
messy in arg_print and the functions it calls. This patch fixes the one
incompatible type (which will do the wrong thing on x86_64) on
branch-1_4.
It also renames obstack_print, to not clash with obstack.h's name space
(I mistakenly thought at first that this was a function provided by the
obstack module).
Cheers,
Ralf
2008-02-23 Ralf Wildenhues <address@hidden>
* src/debug.c (print_to_obstack): Renamed from ...
(obstack_print): ... this.
* src/m4.h: Adjust.
* src/input.c (input_print): Adjust callers.
* src/macro.c (arg_print): Likewise. Also, fix type of plen.
diff --git a/src/debug.c b/src/debug.c
index 737ee52..8e4fac2 100644
--- a/src/debug.c
+++ b/src/debug.c
@@ -408,7 +408,7 @@ trace_post (const char *name, int id, macro_arguments *argv,
reached; otherwise, return false and update MAX_LEN as
appropriate. */
bool
-obstack_print (struct obstack *obs, const char *str, size_t len, int *max_len)
+print_to_obstack (struct obstack *obs, const char *str, size_t len, int
*max_len)
{
int max = max_len ? *max_len : INT_MAX;
diff --git a/src/input.c b/src/input.c
index bbd50f4..8f26e5a 100644
--- a/src/input.c
+++ b/src/input.c
@@ -686,7 +686,7 @@ input_print (struct obstack *obs, const input_block *input)
switch (input->type)
{
case INPUT_STRING:
- obstack_print (obs, input->u.u_s.str, input->u.u_s.len, &maxlen);
+ print_to_obstack (obs, input->u.u_s.str, input->u.u_s.len, &maxlen);
break;
case INPUT_FILE:
obstack_grow (obs, "<file: ", strlen ("<file: "));
@@ -703,7 +703,7 @@ input_print (struct obstack *obs, const input_block *input)
switch (chain->type)
{
case CHAIN_STR:
- if (obstack_print (obs, chain->u.u_s.str, chain->u.u_s.len,
+ if (print_to_obstack (obs, chain->u.u_s.str, chain->u.u_s.len,
&maxlen))
return;
break;
diff --git a/src/m4.h b/src/m4.h
index 0c2a8c8..111e7ff 100644
--- a/src/m4.h
+++ b/src/m4.h
@@ -249,7 +249,7 @@ void trace_pre (const char *, int, macro_arguments *);
void trace_post (const char *, int, macro_arguments *,
const input_block *);
-bool obstack_print (struct obstack *, const char *, size_t, int *);
+bool print_to_obstack (struct obstack *, const char *, size_t, int *);
/* File: input.c --- lexical definitions. */
diff --git a/src/macro.c b/src/macro.c
index 8b7e303..85330d8 100644
--- a/src/macro.c
+++ b/src/macro.c
@@ -1119,7 +1119,7 @@ arg_print (struct obstack *obs, macro_arguments *argv,
unsigned int index,
bool use_sep = false;
bool done;
size_t sep_len;
- size_t *plen = quote_each ? NULL : &len;
+ int *plen = quote_each ? NULL : &len;
if (!sep)
sep = ",";
@@ -1128,23 +1128,23 @@ arg_print (struct obstack *obs, macro_arguments *argv,
unsigned int index,
{
if (quote_each && max_len)
len = *max_len;
- if (use_sep && obstack_print (obs, sep, sep_len, plen))
+ if (use_sep && print_to_obstack (obs, sep, sep_len, plen))
return true;
use_sep = true;
token = arg_token (argv, i, NULL);
switch (TOKEN_DATA_TYPE (token))
{
case TOKEN_TEXT:
- if (quotes && obstack_print (obs, quotes->str1, quotes->len1, plen))
+ if (quotes && print_to_obstack (obs, quotes->str1, quotes->len1,
plen))
return true;
- if (obstack_print (obs, TOKEN_DATA_TEXT (token),
+ if (print_to_obstack (obs, TOKEN_DATA_TEXT (token),
TOKEN_DATA_LEN (token), &len) && !quote_each)
return true;
- if (quotes && obstack_print (obs, quotes->str2, quotes->len2, plen))
+ if (quotes && print_to_obstack (obs, quotes->str2, quotes->len2,
plen))
return true;
break;
case TOKEN_COMP:
- if (quotes && obstack_print (obs, quotes->str1, quotes->len1, plen))
+ if (quotes && print_to_obstack (obs, quotes->str1, quotes->len1,
plen))
return true;
chain = token->u.u_c.chain;
done = false;
@@ -1153,7 +1153,7 @@ arg_print (struct obstack *obs, macro_arguments *argv,
unsigned int index,
switch (chain->type)
{
case CHAIN_STR:
- if (obstack_print (obs, chain->u.u_s.str, chain->u.u_s.len,
+ if (print_to_obstack (obs, chain->u.u_s.str, chain->u.u_s.len,
&len))
done = true;
break;
@@ -1172,7 +1172,7 @@ arg_print (struct obstack *obs, macro_arguments *argv,
unsigned int index,
}
if (done && !quote_each)
return true;
- if (quotes && obstack_print (obs, quotes->str2, quotes->len2, plen))
+ if (quotes && print_to_obstack (obs, quotes->str2, quotes->len2,
plen))
return true;
break;
case TOKEN_FUNC:
- a type fix, obstack_print,
Ralf Wildenhues <=