This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GNU M4 source repository".
http://git.sv.gnu.org/gitweb/?p=m4.git;a=commitdiff;h=6e45bac29917da4289b841d1f339851e1def72d9 The branch, branch-1_4 has been updated via 6e45bac29917da4289b841d1f339851e1def72d9 (commit) from 702a3fe3e8a61c0d4c6da09221559deeff43fabb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6e45bac29917da4289b841d1f339851e1def72d9 Author: Eric Blake <[EMAIL PROTECTED]> Date: Mon Feb 18 06:09:45 2008 -0700 Avoid some magic numbers. * src/m4.h (DEBUG_TRACE_ARGS, DEBUG_TRACE_EXPANSION) (DEBUG_TRACE_QUOTE, DEBUT_TRACE_ALL, DEBUG_TRACE_LINE) (DEBUG_TRACE_FILE, DEBUG_TRACE_PATH, DEBUG_TRACE_CALL) (DEBUG_TRACE_INPUT, DEBUG_TRACE_CALLID, DEBUG_TRACE_VERBOSE) (DEBUG_TRACE_DEFAULT): Use hex constants, to make it obvious these are bit fields. * src/input.c (CHAR_EOF, CHAR_MACRO, CHAR_QUOTE, CHAR_ARGV): Define in terms of UCHAR_MAX. (set_word_regexp): Likewise. * src/builtin.c (compile_pattern, m4_translit): Likewise. Reported by Ralf Wildenhues. Signed-off-by: Eric Blake <[EMAIL PROTECTED]> ----------------------------------------------------------------------- Summary of changes: ChangeLog | 15 +++++++++++++++ src/builtin.c | 6 +++--- src/input.c | 10 +++++----- src/m4.h | 38 +++++++++++++++++++------------------- 4 files changed, 42 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index 76fcac3..86f8cb8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2008-02-18 Eric Blake <[EMAIL PROTECTED]> + + Avoid some magic numbers. + * src/m4.h (DEBUG_TRACE_ARGS, DEBUG_TRACE_EXPANSION) + (DEBUG_TRACE_QUOTE, DEBUT_TRACE_ALL, DEBUG_TRACE_LINE) + (DEBUG_TRACE_FILE, DEBUG_TRACE_PATH, DEBUG_TRACE_CALL) + (DEBUG_TRACE_INPUT, DEBUG_TRACE_CALLID, DEBUG_TRACE_VERBOSE) + (DEBUG_TRACE_DEFAULT): Use hex constants, to make it obvious these + are bit fields. + * src/input.c (CHAR_EOF, CHAR_MACRO, CHAR_QUOTE, CHAR_ARGV): + Define in terms of UCHAR_MAX. + (set_word_regexp): Likewise. + * src/builtin.c (compile_pattern, m4_translit): Likewise. + Reported by Ralf Wildenhues. + 2008-02-16 Eric Blake <[EMAIL PROTECTED]> Add regression test for multi-character quote recursion. diff --git a/src/builtin.c b/src/builtin.c index a48e7a0..d4a0fee 100644 --- a/src/builtin.c +++ b/src/builtin.c @@ -299,7 +299,7 @@ compile_pattern (const char *str, size_t len, struct re_pattern_buffer **buf, return msg; } /* Use a fastmap for speed; it is freed by regfree. */ - new_buf->fastmap = xcharalloc (256); + new_buf->fastmap = xcharalloc (UCHAR_MAX + 1); /* Now, find a victim slot. Decrease the count of all entries, then prime the count of the victim slot at REGEX_CACHE_SIZE. This @@ -1880,8 +1880,8 @@ m4_translit (struct obstack *obs, int argc, macro_arguments *argv) const char *data; const char *from; const char *to; - char map[256] = {0}; - char found[256] = {0}; + char map[UCHAR_MAX + 1] = {0}; + char found[UCHAR_MAX + 1] = {0}; unsigned char ch; if (bad_argc (ARG (0), argc, 2, 3)) diff --git a/src/input.c b/src/input.c index e320c72..5c3b345 100644 --- a/src/input.c +++ b/src/input.c @@ -151,10 +151,10 @@ static bool start_of_input_line; /* Flag for next_char () to recognize change in input block. */ static bool input_change; -#define CHAR_EOF 256 /* Character return on EOF. */ -#define CHAR_MACRO 257 /* Character return for MACRO token. */ -#define CHAR_QUOTE 258 /* Character return for quoted string. */ -#define CHAR_ARGV 259 /* Character return for $@ reference. */ +#define CHAR_EOF (UCHAR_MAX + 1) /* Return on EOF. */ +#define CHAR_MACRO (UCHAR_MAX + 2) /* Return for MACRO token. */ +#define CHAR_QUOTE (UCHAR_MAX + 3) /* Return for quoted string. */ +#define CHAR_ARGV (UCHAR_MAX + 4) /* Return for $@ reference. */ /* Quote chars. */ string_pair curr_quote; @@ -1303,7 +1303,7 @@ set_word_regexp (const char *caller, const char *regexp) The fastmap can be reused between compilations, and will be freed by the final regfree. */ if (!word_regexp.fastmap) - word_regexp.fastmap = xcharalloc (256); + word_regexp.fastmap = xcharalloc (UCHAR_MAX + 1); msg = re_compile_pattern (regexp, strlen (regexp), &word_regexp); assert (!msg); re_set_registers (&word_regexp, ®s, regs.num_regs, regs.start, regs.end); diff --git a/src/m4.h b/src/m4.h index 7df29b8..e1da7a7 100644 --- a/src/m4.h +++ b/src/m4.h @@ -161,32 +161,32 @@ extern FILE *debug; /* The value of debug_level is a bitmask of the following. */ /* a: show arglist in trace output */ -#define DEBUG_TRACE_ARGS 1 +#define DEBUG_TRACE_ARGS 0x001 /* e: show expansion in trace output */ -#define DEBUG_TRACE_EXPANSION 2 +#define DEBUG_TRACE_EXPANSION 0x002 /* q: quote args and expansion in trace output */ -#define DEBUG_TRACE_QUOTE 4 +#define DEBUG_TRACE_QUOTE 0x004 /* t: trace all macros -- overrides trace{on,off} */ -#define DEBUG_TRACE_ALL 8 +#define DEBUG_TRACE_ALL 0x008 /* l: add line numbers to trace output */ -#define DEBUG_TRACE_LINE 16 +#define DEBUG_TRACE_LINE 0x010 /* f: add file name to trace output */ -#define DEBUG_TRACE_FILE 32 +#define DEBUG_TRACE_FILE 0x020 /* p: trace path search of include files */ -#define DEBUG_TRACE_PATH 64 +#define DEBUG_TRACE_PATH 0x040 /* c: show macro call before args collection */ -#define DEBUG_TRACE_CALL 128 +#define DEBUG_TRACE_CALL 0x080 /* i: trace changes of input files */ -#define DEBUG_TRACE_INPUT 256 +#define DEBUG_TRACE_INPUT 0x100 /* x: add call id to trace output */ -#define DEBUG_TRACE_CALLID 512 +#define DEBUG_TRACE_CALLID 0x200 /* V: very verbose -- print everything */ -#define DEBUG_TRACE_VERBOSE 1023 +#define DEBUG_TRACE_VERBOSE 0x377 /* default flags -- equiv: aeq */ -#define DEBUG_TRACE_DEFAULT 7 +#define DEBUG_TRACE_DEFAULT 0x007 -#define DEBUG_PRINT1(Fmt, Arg1) \ +#define DEBUG_PRINT1(Fmt, Arg1) \ do \ { \ if (debug != NULL) \ @@ -194,27 +194,27 @@ extern FILE *debug; } \ while (0) -#define DEBUG_PRINT3(Fmt, Arg1, Arg2, Arg3) \ +#define DEBUG_PRINT3(Fmt, Arg1, Arg2, Arg3) \ do \ { \ if (debug != NULL) \ - xfprintf (debug, Fmt, Arg1, Arg2, Arg3); \ + xfprintf (debug, Fmt, Arg1, Arg2, Arg3); \ } \ while (0) -#define DEBUG_MESSAGE(Fmt) \ +#define DEBUG_MESSAGE(Fmt) \ do \ { \ if (debug != NULL) \ { \ debug_message_prefix (); \ - xfprintf (debug, Fmt); \ + xfprintf (debug, Fmt); \ putc ('\n', debug); \ } \ } \ while (0) -#define DEBUG_MESSAGE1(Fmt, Arg1) \ +#define DEBUG_MESSAGE1(Fmt, Arg1) \ do \ { \ if (debug != NULL) \ @@ -226,7 +226,7 @@ extern FILE *debug; } \ while (0) -#define DEBUG_MESSAGE2(Fmt, Arg1, Arg2) \ +#define DEBUG_MESSAGE2(Fmt, Arg1, Arg2) \ do \ { \ if (debug != NULL) \ hooks/post-receive -- GNU M4 source repository
