[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU M4 source repository branch, master, updated. cvs-readonly-65-
From: |
Eric Blake |
Subject: |
[SCM] GNU M4 source repository branch, master, updated. cvs-readonly-65-g2e81b08 |
Date: |
Mon, 18 Feb 2008 13:29:43 +0000 |
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=2e81b080376fcc4f3362a0c4810de084371c87d0
The branch, master has been updated
via 2e81b080376fcc4f3362a0c4810de084371c87d0 (commit)
from 06991b51ef43dcbafa3d878b2beefd1dcc00adc0 (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 2e81b080376fcc4f3362a0c4810de084371c87d0
Author: Eric Blake <address@hidden>
Date: Mon Feb 18 06:24:08 2008 -0700
Avoid some magic numbers.
* m4/m4private.h (CHAR_EOF, CHAR_BUILTIN, CHAR_QUOTE, CHAR_ARGV)
(CHAR_RETRY): Define in terms of UCHAR_MAX.
* m4/syntax.c (m4_syntax_create, set_syntax_set)
(reset_syntax_set, check_is_single_quotes)
(check_is_single_comments, check_is_macro_escaped)
(m4_set_quotes, m4_set_comment): Likewise.
* modules/gnu.c (regexp_compile): Likewise.
* modules/m4.c (translit): Likewise.
* src/freeze.c (produce_syntax_dump): Likewise.
Reported by Ralf Wildenhues.
Signed-off-by: Eric Blake <address@hidden>
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 14 ++++++++++++++
m4/m4private.h | 12 ++++++------
m4/syntax.c | 24 ++++++++++++------------
modules/gnu.c | 2 +-
modules/m4.c | 4 ++--
src/freeze.c | 4 ++--
6 files changed, 37 insertions(+), 23 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6a89c56..ba56df5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2008-02-18 Eric Blake <address@hidden>
+
+ Avoid some magic numbers.
+ * m4/m4private.h (CHAR_EOF, CHAR_BUILTIN, CHAR_QUOTE, CHAR_ARGV)
+ (CHAR_RETRY): Define in terms of UCHAR_MAX.
+ * m4/syntax.c (m4_syntax_create, set_syntax_set)
+ (reset_syntax_set, check_is_single_quotes)
+ (check_is_single_comments, check_is_macro_escaped)
+ (m4_set_quotes, m4_set_comment): Likewise.
+ * modules/gnu.c (regexp_compile): Likewise.
+ * modules/m4.c (translit): Likewise.
+ * src/freeze.c (produce_syntax_dump): Likewise.
+ Reported by Ralf Wildenhues.
+
2008-02-16 Eric Blake <address@hidden>
Add regression test for multi-character quote recursion.
diff --git a/m4/m4private.h b/m4/m4private.h
index a2b78b8..2201703 100644
--- a/m4/m4private.h
+++ b/m4/m4private.h
@@ -349,7 +349,7 @@ extern void m4__push_arg_quote (m4 *, m4_obstack *,
m4_macro_args *,
VALUE_MACRO_ARGS_BIT))
# define m4_set_symbol_value_text(V, T, L, A) \
- ((V)->type = M4_SYMBOL_TEXT, (V)->u.u_t.text = (T), \
+ ((V)->type = M4_SYMBOL_TEXT, (V)->u.u_t.text = (T), \
(V)->u.u_t.len = (L), (V)->u.u_t.quote_age = (A))
# define m4_set_symbol_value_builtin(V, B) \
((V)->type = M4_SYMBOL_FUNC, (V)->u.builtin = (B))
@@ -395,11 +395,11 @@ extern void m4__symtab_remove_module_references
(m4_symbol_table*,
/* CHAR_RETRY must be last, because we size the syntax table to hold
all other characters and sentinels. */
-#define CHAR_EOF 256 /* Character return on EOF. */
-#define CHAR_BUILTIN 257 /* Character return for BUILTIN token. */
-#define CHAR_QUOTE 258 /* Character return for quoted string. */
-#define CHAR_ARGV 259 /* Character return for $@ reference. */
-#define CHAR_RETRY 260 /* Character return for end of input block. */
+#define CHAR_EOF (UCHAR_MAX + 1) /* Return on EOF. */
+#define CHAR_BUILTIN (UCHAR_MAX + 2) /* Return for BUILTIN token. */
+#define CHAR_QUOTE (UCHAR_MAX + 3) /* Return for quoted string. */
+#define CHAR_ARGV (UCHAR_MAX + 4) /* Return for $@ reference. */
+#define CHAR_RETRY (UCHAR_MAX + 5) /* Return for end of input block. */
#define DEF_LQUOTE "`" /* Default left quote delimiter. */
#define DEF_RQUOTE "\'" /* Default right quote delimiter. */
diff --git a/m4/syntax.c b/m4/syntax.c
index 8a7b0d1..115884e 100644
--- a/m4/syntax.c
+++ b/m4/syntax.c
@@ -116,7 +116,7 @@ m4_syntax_create (void)
int ch;
/* Set up default table. This table never changes during operation. */
- for (ch = 256; --ch >= 0;)
+ for (ch = UCHAR_MAX + 1; --ch >= 0; )
switch (ch)
{
case '(':
@@ -309,7 +309,7 @@ set_syntax_set (m4_syntax_table *syntax, const char *chars,
int code)
/* Explicit set of characters to install with this category; all
other characters that used to have the category get reset to
OTHER. */
- for (ch = 256; --ch >= 0; )
+ for (ch = UCHAR_MAX + 1; --ch >= 0; )
{
if (code == M4_SYNTAX_RQUOTE || code == M4_SYNTAX_ECOMM)
remove_syntax_attribute (syntax, ch, code);
@@ -329,7 +329,7 @@ static void
reset_syntax_set (m4_syntax_table *syntax, int code)
{
int ch;
- for (ch = 256; --ch >= 0; )
+ for (ch = UCHAR_MAX + 1; --ch >= 0; )
{
/* Reset the category back to its default state. All other
characters that used to have this category get reset to
@@ -443,7 +443,7 @@ check_is_single_quotes (m4_syntax_table *syntax)
on the syntax table, then update lquote/rquote accordingly.
Otherwise, keep lquote/rquote, but we no longer have single
quotes. */
- for (ch = 256; --ch >= 0; )
+ for (ch = UCHAR_MAX + 1; --ch >= 0; )
{
if (m4_has_syntax (syntax, ch, M4_SYNTAX_LQUOTE))
{
@@ -496,7 +496,7 @@ check_is_single_comments (m4_syntax_table *syntax)
on the syntax table, then update bcomm/ecomm accordingly.
Otherwise, keep bcomm/ecomm, but we no longer have single
comments. */
- for (ch = 256; --ch >= 0; )
+ for (ch = UCHAR_MAX + 1; --ch >= 0; )
{
if (m4_has_syntax (syntax, ch, M4_SYNTAX_BCOMM))
{
@@ -535,7 +535,7 @@ check_is_macro_escaped (m4_syntax_table *syntax)
int ch;
syntax->is_macro_escaped = false;
- for (ch = 256; --ch >= 0; )
+ for (ch = UCHAR_MAX + 1; --ch >= 0; )
if (m4_has_syntax (syntax, ch, M4_SYNTAX_ESCAPE))
{
syntax->is_macro_escaped = true;
@@ -593,7 +593,7 @@ m4_set_quotes (m4_syntax_table *syntax, const char *lq,
const char *rq)
(M4_SYNTAX_IGNORE | M4_SYNTAX_ESCAPE
| M4_SYNTAX_ALPHA | M4_SYNTAX_NUM)));
- for (ch = 256; --ch >= 0;)
+ for (ch = UCHAR_MAX + 1; --ch >= 0; )
{
if (m4_has_syntax (syntax, ch, M4_SYNTAX_LQUOTE))
add_syntax_attribute (syntax, ch,
@@ -656,7 +656,7 @@ m4_set_comment (m4_syntax_table *syntax, const char *bc,
const char *ec)
| M4_SYNTAX_ALPHA | M4_SYNTAX_NUM
| M4_SYNTAX_LQUOTE)));
- for (ch = 256; --ch >= 0;)
+ for (ch = UCHAR_MAX + 1; --ch >= 0; )
{
if (m4_has_syntax (syntax, ch, M4_SYNTAX_BCOMM))
add_syntax_attribute (syntax, ch,
@@ -744,10 +744,10 @@ set_quote_age (m4_syntax_table *syntax, bool reset, bool
change)
| M4_SYNTAX_SPACE))
&& *syntax->quote.str1 != *syntax->quote.str2
&& (!syntax->comm.len1
- || (*syntax->comm.str1 != *syntax->quote.str2
- && !m4_has_syntax (syntax, *syntax->comm.str1,
- (M4_SYNTAX_OPEN | M4_SYNTAX_COMMA
- | M4_SYNTAX_CLOSE))))
+ || (*syntax->comm.str1 != *syntax->quote.str2
+ && !m4_has_syntax (syntax, *syntax->comm.str1,
+ (M4_SYNTAX_OPEN | M4_SYNTAX_COMMA
+ | M4_SYNTAX_CLOSE))))
&& m4_has_syntax (syntax, ',', M4_SYNTAX_COMMA))
{
syntax->quote_age = ((local_syntax_age << 16)
diff --git a/modules/gnu.c b/modules/gnu.c
index f3b7fb7..97b263b 100644
--- a/modules/gnu.c
+++ b/modules/gnu.c
@@ -176,7 +176,7 @@ regexp_compile (m4 *context, const char *caller, const char
*regexp,
return NULL;
}
/* Use a fastmap for speed; it is freed by regfree. */
- pat->fastmap = xcharalloc (256);
+ pat->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
diff --git a/modules/m4.c b/modules/m4.c
index ccc847c..afb9d0c 100644
--- a/modules/m4.c
+++ b/modules/m4.c
@@ -998,8 +998,8 @@ M4BUILTIN_HANDLER (translit)
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 (argc <= 2)
diff --git a/src/freeze.c b/src/freeze.c
index 941b761..7976bec 100644
--- a/src/freeze.c
+++ b/src/freeze.c
@@ -103,12 +103,12 @@ produce_resyntax_dump (m4 *context, FILE *file)
static void
produce_syntax_dump (FILE *file, m4_syntax_table *syntax, char ch)
{
- char buf[256];
+ char buf[UCHAR_MAX + 1];
int code = m4_syntax_code (ch);
int count = 0;
int i;
- for (i = 0; i < 256; ++i)
+ for (i = 0; i < UCHAR_MAX + 1; ++i)
if (m4_has_syntax (syntax, i, code) && code != syntax->orig[i])
buf[count++] = i;
hooks/post-receive
--
GNU M4 source repository
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU M4 source repository branch, master, updated. cvs-readonly-65-g2e81b08,
Eric Blake <=