[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-79-
From: |
Eric Blake |
Subject: |
[SCM] GNU M4 source repository branch, master, updated. cvs-readonly-79-g951a9ef |
Date: |
Thu, 13 Mar 2008 18:18:50 +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=951a9ef5bbd7eda50bba0ec8b28d57bfbf85c87e
The branch, master has been updated
via 951a9ef5bbd7eda50bba0ec8b28d57bfbf85c87e (commit)
from 2510870d46c28568affaa04f31462cd77fcf36f8 (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 951a9ef5bbd7eda50bba0ec8b28d57bfbf85c87e
Author: Eric Blake <address@hidden>
Date: Thu Mar 13 12:06:23 2008 -0600
Consistently cast malloc results, for C++ compilation.
* m4/builtin.c (m4_builtin_find_by_name): Add cast.
* m4/hash.c (m4_hash_new, m4_get_hash_iterator_next, node_new)
(m4_hash_resize, maybe_grow): Likewise.
* m4/m4.c (m4_create): Likewise.
* m4/macro.c (expand_macro): Likewise.
* m4/output.c (m4_tmpname): Likewise.
* m4/path.c (search_path_add): Likewise.
* m4/symtab.c (m4_symtab_create, m4_symbol_value_create)
(symtab_fetch): Likewise.
* m4/syntax.c (m4_syntax_create): Likewise.
* modules/gnu.c (regexp_compile): Likewise.
* src/main.c (main): Likewise.
* src/freeze.c (reload_frozen_state): Likewise.
Signed-off-by: Eric Blake <address@hidden>
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 17 +++++++++++++++++
m4/builtin.c | 6 +++---
m4/hash.c | 20 ++++++++++----------
m4/m4.c | 9 +++++----
m4/macro.c | 4 ++--
m4/output.c | 3 ++-
m4/path.c | 7 +++----
m4/symtab.c | 23 ++++++++++++-----------
m4/syntax.c | 2 +-
modules/gnu.c | 2 +-
src/freeze.c | 13 +++++++------
src/main.c | 4 ++--
12 files changed, 65 insertions(+), 45 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 18e2855..1e1d811 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2008-03-13 Eric Blake <address@hidden>
+
+ Consistently cast malloc results, for C++ compilation.
+ * m4/builtin.c (m4_builtin_find_by_name): Add cast.
+ * m4/hash.c (m4_hash_new, m4_get_hash_iterator_next, node_new)
+ (m4_hash_resize, maybe_grow): Likewise.
+ * m4/m4.c (m4_create): Likewise.
+ * m4/macro.c (expand_macro): Likewise.
+ * m4/output.c (m4_tmpname): Likewise.
+ * m4/path.c (search_path_add): Likewise.
+ * m4/symtab.c (m4_symtab_create, m4_symbol_value_create)
+ (symtab_fetch): Likewise.
+ * m4/syntax.c (m4_syntax_create): Likewise.
+ * modules/gnu.c (regexp_compile): Likewise.
+ * src/main.c (main): Likewise.
+ * src/freeze.c (reload_frozen_state): Likewise.
+
2008-03-06 Eric Blake <address@hidden>
Fix nested builtin(`shift',$@) regression from 2008-02-23.
diff --git a/m4/builtin.c b/m4/builtin.c
index a83b4f5..9003b5b 100644
--- a/m4/builtin.c
+++ b/m4/builtin.c
@@ -1,6 +1,6 @@
/* GNU m4 -- A simple macro processor
Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 1999, 2000, 2005,
- 2006, 2007 Free Software Foundation, Inc.
+ 2006, 2007, 2008 Free Software Foundation, Inc.
This file is part of GNU M4.
@@ -44,8 +44,8 @@ m4_builtin_find_by_name (m4_module *module, const char *name)
for (; builtin->name != NULL; builtin++)
if (!strcmp (builtin->name, name))
{
- m4_symbol_value *token = xzalloc (sizeof *token);
-
+ m4_symbol_value *token;
+ token = (m4_symbol_value *) xzalloc (sizeof *token);
m4_set_symbol_value_builtin (token, builtin);
VALUE_MODULE (token) = cur;
VALUE_FLAGS (token) = builtin->flags;
diff --git a/m4/hash.c b/m4/hash.c
index c47a7e4..ec3238f 100644
--- a/m4/hash.c
+++ b/m4/hash.c
@@ -1,5 +1,5 @@
/* GNU m4 -- A simple macro processor
- Copyright (C) 2001, 2006, 2007 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2006, 2007, 2008 Free Software Foundation, Inc.
Written by Gary V. Vaughan <address@hidden>
This file is part of GNU M4.
@@ -127,10 +127,11 @@ m4_hash_new (size_t size, m4_hash_hash_func *hash_func,
if (size == 0)
size = M4_HASH_DEFAULT_SIZE;
- hash = xmalloc (sizeof *hash);
+ hash = (m4_hash *) xmalloc (sizeof *hash);
HASH_SIZE (hash) = size;
HASH_LENGTH (hash) = 0;
- HASH_BUCKETS (hash) = xcalloc (size, sizeof *HASH_BUCKETS (hash));
+ HASH_BUCKETS (hash) = (hash_node **) xcalloc (size,
+ sizeof *HASH_BUCKETS (hash));
HASH_HASH_FUNC (hash) = hash_func;
HASH_CMP_FUNC (hash) = cmp_func;
#ifndef NDEBUG
@@ -215,9 +216,7 @@ node_new (const void *key, void *value)
free_list = NODE_NEXT (free_list);
}
else
- {
- node = xmalloc (sizeof *node);
- }
+ node = (hash_node *) xmalloc (sizeof *node);
assert (node);
@@ -399,7 +398,8 @@ m4_hash_resize (m4_hash *hash, size_t size)
original_buckets = HASH_BUCKETS (hash);
HASH_SIZE (hash) = size;
- HASH_BUCKETS (hash) = xcalloc (size, sizeof *HASH_BUCKETS (hash));
+ HASH_BUCKETS (hash) = (hash_node **) xcalloc (size,
+ sizeof *HASH_BUCKETS (hash));
{
size_t i;
@@ -430,8 +430,8 @@ maybe_grow (m4_hash *hash)
/* HASH sizes are always 1 less than a power of 2. */
HASH_SIZE (hash) = (2 * (1 + original_size)) -1;
- HASH_BUCKETS (hash) = xcalloc (HASH_SIZE (hash),
- sizeof *HASH_BUCKETS (hash));
+ HASH_BUCKETS (hash) =
+ (hash_node **) xcalloc (HASH_SIZE (hash), sizeof *HASH_BUCKETS (hash));
{
size_t i;
@@ -499,7 +499,7 @@ m4_get_hash_iterator_next (const m4_hash *hash,
m4_hash_iterator *place)
/* On the first iteration, allocate an iterator. */
if (!place)
{
- place = xzalloc (sizeof *place);
+ place = (m4_hash_iterator *) xzalloc (sizeof *place);
ITERATOR_HASH (place) = hash;
#ifndef NDEBUG
ITER_CHAIN (place) = HASH_ITER (hash);
diff --git a/m4/m4.c b/m4/m4.c
index 066f97f..1fc1f11 100644
--- a/m4/m4.c
+++ b/m4/m4.c
@@ -1,6 +1,6 @@
/* GNU m4 -- A simple macro processor
- Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2001, 2004, 2006, 2007
- Free Software Foundation, Inc.
+ Copyright (C) 1989, 1990, 1991, 1992, 1993, 1994, 2001, 2004, 2006,
+ 2007, 2008 Free Software Foundation, Inc.
This file is part of GNU M4.
@@ -28,7 +28,7 @@
m4 *
m4_create (void)
{
- m4 *context = xzalloc (sizeof *context);
+ m4 *context = (m4 *) xzalloc (sizeof *context);
context->symtab = m4_symtab_create (0);
context->syntax = m4_syntax_create ();
@@ -39,7 +39,8 @@ m4_create (void)
context->nesting_limit = DEFAULT_NESTING_LIMIT;
context->max_debug_arg_length = SIZE_MAX;
- context->search_path = xzalloc (sizeof *context->search_path);
+ context->search_path =
+ (m4__search_path_info *) xzalloc (sizeof *context->search_path);
m4__include_init (context);
return context;
diff --git a/m4/macro.c b/m4/macro.c
index ad23389..1894d69 100644
--- a/m4/macro.c
+++ b/m4/macro.c
@@ -479,8 +479,8 @@ expand_macro (m4 *context, const char *name, size_t len,
m4_symbol *symbol)
if (!stack->args)
{
assert (!stack->refcount);
- stack->args = xmalloc (sizeof *stack->args);
- stack->argv = xmalloc (sizeof *stack->argv);
+ stack->args = (m4_obstack *) xmalloc (sizeof *stack->args);
+ stack->argv = (m4_obstack *) xmalloc (sizeof *stack->argv);
obstack_init (stack->args);
obstack_init (stack->argv);
stack->args_base = obstack_finish (stack->args);
diff --git a/m4/output.c b/m4/output.c
index d6c6cc5..6f1be1c 100644
--- a/m4/output.c
+++ b/m4/output.c
@@ -200,7 +200,8 @@ m4_tmpname (int divnum)
obstack_1grow (&diversion_storage, '4');
obstack_1grow (&diversion_storage, '-');
offset = obstack_object_size (&diversion_storage);
- buffer = obstack_alloc (&diversion_storage, INT_BUFSIZE_BOUND (divnum));
+ buffer = (char *) obstack_alloc (&diversion_storage,
+ INT_BUFSIZE_BOUND (divnum));
}
if (snprintf (&buffer[offset], INT_BUFSIZE_BOUND (divnum), "%d", divnum) < 0)
abort ();
diff --git a/m4/path.c b/m4/path.c
index 0781655..91991e0 100644
--- a/m4/path.c
+++ b/m4/path.c
@@ -1,7 +1,6 @@
/* GNU m4 -- A simple macro processor
-
- Copyright (C) 1989, 1990, 1991, 1992, 1993, 1998, 2004, 2006, 2007
- Free Software Foundation, Inc.
+ Copyright (C) 1989, 1990, 1991, 1992, 1993, 1998, 2004, 2006, 2007,
+ 2008 Free Software Foundation, Inc.
This file is part of GNU M4.
@@ -45,7 +44,7 @@ static void search_path_env_init (m4__search_path_info *,
char *, bool);
static void
search_path_add (m4__search_path_info *info, const char *dir, bool prepend)
{
- m4__search_path *path = xmalloc (sizeof *path);
+ m4__search_path *path = (m4__search_path *) xmalloc (sizeof *path);
path->len = strlen (dir);
path->dir = xstrdup (dir);
diff --git a/m4/symtab.c b/m4/symtab.c
index dc05c1b..f8b84bf 100644
--- a/m4/symtab.c
+++ b/m4/symtab.c
@@ -69,7 +69,7 @@ static void * arg_copy_CB (m4_hash *src, const
void *name,
m4_symbol_table *
m4_symtab_create (size_t size)
{
- m4_symbol_table *symtab = xmalloc (sizeof *symtab);
+ m4_symbol_table *symtab = (m4_symbol_table *) xmalloc (sizeof *symtab);
symtab->table = m4_hash_new (size ? size : M4_SYMTAB_DEFAULT_SIZE,
m4_hash_string_hash, m4_hash_string_cmp);
@@ -138,7 +138,7 @@ symtab_fetch (m4_symbol_table *symtab, const char *name)
}
else
{
- symbol = xzalloc (sizeof *symbol);
+ symbol = (m4_symbol *) xzalloc (sizeof *symbol);
m4_hash_insert (symtab->table, xstrdup (name), symbol);
}
@@ -312,6 +312,16 @@ symbol_popval (m4_symbol *symbol)
}
}
+/* Create a new symbol value, with fields populated for default
+ behavior. */
+m4_symbol_value *
+m4_symbol_value_create (void)
+{
+ m4_symbol_value *value = (m4_symbol_value *) xzalloc (sizeof *value);
+ VALUE_MAX_ARGS (value) = SIZE_MAX;
+ return value;
+}
+
/* Remove VALUE from the symbol table, and mark it as deleted. If no
expansions are pending, reclaim its resources. */
void
@@ -701,15 +711,6 @@ m4_get_symbol_traced (m4_symbol *symbol)
return symbol->traced;
}
-#undef m4_symbol_value_create
-m4_symbol_value *
-m4_symbol_value_create (void)
-{
- m4_symbol_value *value = xzalloc (sizeof (m4_symbol_value));
- VALUE_MAX_ARGS (value) = SIZE_MAX;
- return value;
-}
-
#undef m4_symbol_value_groks_macro
bool
m4_symbol_value_groks_macro (m4_symbol_value *value)
diff --git a/m4/syntax.c b/m4/syntax.c
index 7479388..5892f2a 100644
--- a/m4/syntax.c
+++ b/m4/syntax.c
@@ -112,7 +112,7 @@ static void set_quote_age (m4_syntax_table *,
bool, bool);
m4_syntax_table *
m4_syntax_create (void)
{
- m4_syntax_table *syntax = xzalloc (sizeof *syntax);
+ m4_syntax_table *syntax = (m4_syntax_table *) xzalloc (sizeof *syntax);
int ch;
/* Set up default table. This table never changes during operation. */
diff --git a/modules/gnu.c b/modules/gnu.c
index 97b263b..b4c36af 100644
--- a/modules/gnu.c
+++ b/modules/gnu.c
@@ -163,7 +163,7 @@ regexp_compile (m4 *context, const char *caller, const char
*regexp,
}
/* Next, check if REGEXP can be compiled. */
- pat = xzalloc (sizeof *pat);
+ pat = (struct re_pattern_buffer *) xzalloc (sizeof *pat);
re_set_syntax (resyntax);
msg = re_compile_pattern (regexp, len, pat);
diff --git a/src/freeze.c b/src/freeze.c
index 7976bec..8df64ce 100644
--- a/src/freeze.c
+++ b/src/freeze.c
@@ -429,7 +429,7 @@ reload_frozen_state (m4 *context, const char *name)
{ \
free (Where); \
(Allocated) = (Needed) + 1; \
- (Where) = xmalloc (Allocated); \
+ (Where) = xcharalloc (Allocated); \
} \
} \
while (0)
@@ -455,11 +455,11 @@ reload_frozen_state (m4 *context, const char *name)
m4_error (context, EXIT_FAILURE, errno, NULL, _("cannot open `%s'"), name);
allocated[0] = 100;
- string[0] = xmalloc (allocated[0]);
+ string[0] = xcharalloc (allocated[0]);
allocated[1] = 100;
- string[1] = xmalloc (allocated[1]);
+ string[1] = xcharalloc (allocated[1]);
allocated[2] = 100;
- string[2] = xmalloc (allocated[2]);
+ string[2] = xcharalloc (allocated[2]);
/* Validate format version. Accept both `1' (m4 1.3 and 1.4.x) and
`2' (m4 2.0). */
@@ -553,7 +553,7 @@ ill-formed frozen file, version 2 directive `%c'
encountered"), 'F');
if (token == NULL)
{
- token = xzalloc (sizeof *token);
+ token = (m4_symbol_value *) xzalloc (sizeof *token);
m4_set_symbol_value_placeholder (token, xstrdup (string[1]));
VALUE_MODULE (token) = module;
VALUE_MIN_ARGS (token) = 0;
@@ -744,9 +744,10 @@ ill-formed frozen file, version 2 directive `%c'
encountered"), 'T');
/* Enter a macro having an expansion text as a definition. */
{
- m4_symbol_value *token = xzalloc (sizeof *token);
+ m4_symbol_value *token;
m4_module *module = NULL;
+ token = (m4_symbol_value *) xzalloc (sizeof *token);
if (number[2] > 0)
module = m4__module_find (string[2]);
diff --git a/src/main.c b/src/main.c
index a11e821..b06a893 100644
--- a/src/main.c
+++ b/src/main.c
@@ -430,7 +430,7 @@ main (int argc, char *const *argv, char *const *envp)
case UNLOAD_MODULE_OPTION:
/* Arguments that cannot be handled until later are accumulated. */
- defn = xmalloc (sizeof *defn);
+ defn = (deferred *) xmalloc (sizeof *defn);
defn->code = optchar;
defn->value = optarg;
defn->next = NULL;
@@ -648,7 +648,7 @@ main (int argc, char *const *argv, char *const *envp)
for (env = envp; *env != NULL; env++)
{
- defn = xmalloc (sizeof *defn);
+ defn = (deferred *) xmalloc (sizeof *defn);
defn->code = 'D';
defn->value = *env;
defn->next = head;
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-79-g951a9ef,
Eric Blake <=