bitmap.c: Use type-safe memory allocation macros from libiberty.

* bitmap.c: Use type-safe memory allocation macros from libiberty.
	* c-common.c: Likewise.
	* c-decl.c: Likewise.
	* c-lang.c: Likewise.
	* c-lex.c: Likewise.
	* c-opts.c: Likewise.
	* c-parse.in: Likewise.
	* c-typeck.c: Likewise.
	* genconditions.c: Likewise.
	* gengtype-lex.l: Likewise.
	* gengtype-yacc.y: Likewise.
	* gengtype.c: Likewise.
	* genmodes.c: Likewise.
	* gensupport.c: Likewise.
	* read-rtl.c: Likewise.
	* read-rtl.c (read_constants): Use INSERT instead of TRUE in call to
	htab_find_slot().

From-SVN: r85163
This commit is contained in:
Bernardo Innocenti 2004-07-25 22:43:23 +02:00 committed by Bernardo Innocenti
parent b12a648242
commit 5d038c4cb1
16 changed files with 102 additions and 80 deletions

View File

@ -1,3 +1,23 @@
2004-07-25 Bernardo Innocenti <bernie@develer.com>
* bitmap.c: Use type-safe memory allocation macros from libiberty.
* c-common.c: Likewise.
* c-decl.c: Likewise.
* c-lang.c: Likewise.
* c-lex.c: Likewise.
* c-opts.c: Likewise.
* c-parse.in: Likewise.
* c-typeck.c: Likewise.
* genconditions.c: Likewise.
* gengtype-lex.l: Likewise.
* gengtype-yacc.y: Likewise.
* gengtype.c: Likewise.
* genmodes.c: Likewise.
* gensupport.c: Likewise.
* read-rtl.c: Likewise.
* read-rtl.c (read_constants): Use INSERT instead of TRUE in call to
htab_find_slot().
2004-07-25 Bernardo Innocenti <bernie@develer.com>
* c-decl.c (groktypename, groktypename_in_param_context): Rename

View File

@ -131,7 +131,7 @@ bitmap_element_allocate (bitmap head)
obstack_chunk_free);
}
element = obstack_alloc (&bitmap_obstack, sizeof (bitmap_element));
element = XOBNEW (&bitmap_obstack, bitmap_element);
}
}
else
@ -142,7 +142,7 @@ bitmap_element_allocate (bitmap head)
bitmap_ggc_free = element->next;
}
else
element = ggc_alloc (sizeof (bitmap_element));
element = GGC_NEW (bitmap_element);
}
memset (element->bits, 0, sizeof (element->bits));
@ -716,7 +716,7 @@ bitmap
bitmap_initialize (bitmap head, int using_obstack)
{
if (head == NULL && ! using_obstack)
head = ggc_alloc (sizeof (*head));
head = GGC_NEW (struct bitmap_head_def);
head->first = head->current = 0;
head->using_obstack = using_obstack;

View File

@ -1051,7 +1051,7 @@ static struct tlist *
new_tlist (struct tlist *next, tree t, tree writer)
{
struct tlist *l;
l = obstack_alloc (&tlist_obstack, sizeof *l);
l = XOBNEW (&tlist_obstack, struct tlist);
l->next = next;
l->expr = t;
l->writer = writer;
@ -1322,7 +1322,7 @@ verify_tree (tree x, struct tlist **pbefore_sp, struct tlist **pno_sp,
if (! t)
{
t = obstack_alloc (&tlist_obstack, sizeof *t);
t = XOBNEW (&tlist_obstack, struct tlist_cache);
t->next = save_expr_cache;
t->expr = x;
save_expr_cache = t;

View File

@ -428,7 +428,7 @@ bind (tree name, tree decl, struct c_scope *scope, bool invisible, bool nested)
binding_freelist = b->prev;
}
else
b = ggc_alloc (sizeof (struct c_binding));
b = GGC_NEW (struct c_binding);
b->shadowed = 0;
b->decl = decl;
@ -603,7 +603,7 @@ push_scope (void)
scope_freelist = scope->outer;
}
else
scope = ggc_alloc_cleared (sizeof (struct c_scope));
scope = GGC_CNEW (struct c_scope);
scope->keep = keep_next_level_flag;
scope->outer = current_scope;
@ -1858,7 +1858,7 @@ pushdecl (tree x)
/* Functions need the lang_decl data. */
if (TREE_CODE (x) == FUNCTION_DECL && ! DECL_LANG_SPECIFIC (x))
DECL_LANG_SPECIFIC (x) = ggc_alloc_cleared (sizeof (struct lang_decl));
DECL_LANG_SPECIFIC (x) = GGC_CNEW (struct lang_decl);
/* Must set DECL_CONTEXT for everything not at file scope or
DECL_FILE_SCOPE_P won't work. Local externs don't count
@ -4495,7 +4495,7 @@ grokdeclarator (tree declarator, tree declspecs,
decl = build_decl_attribute_variant (decl, decl_attr);
DECL_LANG_SPECIFIC (decl)
= ggc_alloc_cleared (sizeof (struct lang_decl));
= GGC_CNEW (struct lang_decl);
if (pedantic && type_quals && ! DECL_IN_SYSTEM_HEADER (decl))
pedwarn ("ISO C forbids qualified function types");
@ -5324,8 +5324,9 @@ finish_struct (tree t, tree fieldlist, tree attributes)
ensure that this lives as long as the rest of the struct decl.
All decls in an inline function need to be saved. */
space = ggc_alloc_cleared (sizeof (struct lang_type));
space2 = ggc_alloc (sizeof (struct sorted_fields_type) + len * sizeof (tree));
space = GGC_CNEW (struct lang_type);
space2 = GGC_NEWVAR (struct sorted_fields_type,
sizeof (struct sorted_fields_type) + len * sizeof (tree));
len = 0;
space->s = space2;
@ -5548,7 +5549,7 @@ finish_enum (tree enumtype, tree values, tree attributes)
/* Record the min/max values so that we can warn about bit-field
enumerations that are too small for the values. */
lt = ggc_alloc_cleared (sizeof (struct lang_type));
lt = GGC_CNEW (struct lang_type);
lt->enum_min = minnode;
lt->enum_max = maxnode;
TYPE_LANG_SPECIFIC (enumtype) = lt;
@ -6451,7 +6452,7 @@ void
c_push_function_context (struct function *f)
{
struct language_function *p;
p = ggc_alloc (sizeof (struct language_function));
p = GGC_NEW (struct language_function);
f->language = p;
p->base.x_stmt_tree = c_stmt_tree;
@ -6505,7 +6506,7 @@ c_dup_lang_specific_decl (tree decl)
if (!DECL_LANG_SPECIFIC (decl))
return;
ld = ggc_alloc (sizeof (struct lang_decl));
ld = GGC_NEW (struct lang_decl);
memcpy (ld, DECL_LANG_SPECIFIC (decl), sizeof (struct lang_decl));
DECL_LANG_SPECIFIC (decl) = ld;
}
@ -6631,7 +6632,7 @@ static void
c_write_global_declarations_1 (tree globals)
{
size_t len = list_length (globals);
tree *vec = xmalloc (sizeof (tree) * len);
tree *vec = XNEWVEC (tree, len);
size_t i;
tree decl;

View File

@ -122,7 +122,7 @@ get_fileinfo (const char *name)
if (n)
return (struct c_fileinfo *) n->value;
fi = xmalloc (sizeof (struct c_fileinfo));
fi = XNEW (struct c_fileinfo);
fi->time = 0;
fi->interface_only = 0;
fi->interface_unknown = 1;

View File

@ -285,11 +285,11 @@ void
c_initialize_diagnostics (diagnostic_context *context)
{
pretty_printer *base = context->printer;
c_pretty_printer *pp = xmalloc (sizeof (c_pretty_printer));
c_pretty_printer *pp = XNEW (c_pretty_printer);
memcpy (pp_base (pp), base, sizeof (pretty_printer));
pp_c_pretty_printer_init (pp);
context->printer = (pretty_printer *) pp;
/* It is safe to free this object because it was previously malloc()'d. */
free (base);
/* It is safe to free this object because it was previously XNEW()'d. */
XDELETE (base);
}

View File

@ -226,7 +226,7 @@ c_common_init_options (unsigned int argc, const char ** ARG_UNUSED (argv))
flag_exceptions = c_dialect_cxx ();
warn_pointer_arith = c_dialect_cxx ();
deferred_opts = xmalloc (argc * sizeof (struct deferred_opt));
deferred_opts = XNEWVEC (struct deferred_opt, argc);
result = lang_flags[c_language];
@ -913,7 +913,7 @@ c_common_post_options (const char **pfilename)
/* Canonicalize the input and output filenames. */
if (in_fnames == NULL)
{
in_fnames = xmalloc (sizeof (in_fnames[0]));
in_fnames = XNEWVEC (const char *, 1);
in_fnames[0] = "";
}
else if (strcmp (in_fnames[0], "-") == 0)
@ -1256,7 +1256,7 @@ add_prefixed_path (const char *suffix, size_t chain)
prefix = iprefix ? iprefix : cpp_GCC_INCLUDE_DIR;
prefix_len = iprefix ? strlen (iprefix) : cpp_GCC_INCLUDE_DIR_len;
path = xmalloc (prefix_len + suffix_len + 1);
path = (char *) xmalloc (prefix_len + suffix_len + 1);
memcpy (path, prefix, prefix_len);
memcpy (path + prefix_len, suffix, suffix_len);
path[prefix_len + suffix_len] = '\0';

View File

@ -3451,7 +3451,7 @@ init_reswords (void)
if (!c_dialect_objc ())
mask |= D_OBJC;
ridpointers = ggc_calloc ((int) RID_MAX, sizeof (tree));
ridpointers = GGC_CNEWVEC (tree, (int) RID_MAX);
for (i = 0; i < N_reswords; i++)
{
/* If a keyword is disabled, do not enter it into the table

View File

@ -3756,10 +3756,10 @@ static int spelling_size; /* Size of the spelling stack. */
{ \
spelling_size += 10; \
if (spelling_base == 0) \
spelling_base = xmalloc (spelling_size * sizeof (struct spelling)); \
spelling_base = XNEWVEC (struct spelling, spelling_size); \
else \
spelling_base = xrealloc (spelling_base, \
spelling_size * sizeof (struct spelling)); \
spelling_base = XRESIZEVEC (struct spelling, spelling_base, \
spelling_size); \
RESTORE_SPELLING_DEPTH (depth); \
} \
\
@ -4309,7 +4309,7 @@ void
start_init (tree decl, tree asmspec_tree, int top_level)
{
const char *locus;
struct initializer_stack *p = xmalloc (sizeof (struct initializer_stack));
struct initializer_stack *p = XNEW (struct initializer_stack);
const char *asmspec = 0;
if (asmspec_tree)
@ -4411,7 +4411,7 @@ finish_init (void)
void
really_start_incremental_init (tree type)
{
struct constructor_stack *p = xmalloc (sizeof (struct constructor_stack));
struct constructor_stack *p = XNEW (struct constructor_stack);
if (type == 0)
type = TREE_TYPE (constructor_decl);
@ -4548,7 +4548,7 @@ push_init_level (int implicit)
value = find_init_member (constructor_index);
}
p = xmalloc (sizeof (struct constructor_stack));
p = XNEW (struct constructor_stack);
p->type = constructor_type;
p->fields = constructor_fields;
p->index = constructor_index;
@ -4941,7 +4941,7 @@ push_range_stack (tree range_end)
{
struct constructor_range_stack *p;
p = ggc_alloc (sizeof (struct constructor_range_stack));
p = GGC_NEW (struct constructor_range_stack);
p->prev = constructor_range_stack;
p->next = 0;
p->fields = constructor_fields;
@ -5122,7 +5122,7 @@ add_pending_init (tree purpose, tree value)
}
}
r = ggc_alloc (sizeof (struct init_node));
r = GGC_NEW (struct init_node);
r->purpose = purpose;
r->value = value;
@ -6391,8 +6391,9 @@ c_start_case (tree exp)
}
/* Add this new SWITCH_STMT to the stack. */
cs = xmalloc (sizeof (*cs));
cs->switch_stmt = build_stmt (SWITCH_STMT, exp, NULL_TREE, orig_type);
cs = XNEW (struct c_switch);
cs->switch_stmt = build_stmt ((enum tree_code) SWITCH_STMT, exp, NULL_TREE,
orig_type);
cs->orig_type = orig_type;
cs->cases = splay_tree_new (case_compare, NULL, NULL);
cs->next = c_switch_stack;
@ -6440,7 +6441,7 @@ c_finish_case (tree body)
/* Pop the stack. */
c_switch_stack = cs->next;
splay_tree_delete (cs->cases);
free (cs);
XDELETE (cs);
}
/* Emit an if statement. IF_LOCUS is the location of the 'if'. COND,

View File

@ -57,7 +57,7 @@ add_condition (const char *expr)
if (expr[0] == 0)
return;
test = xmalloc (sizeof (struct c_test));
test = XNEW (struct c_test);
test->expr = expr;
*(htab_find_slot (condition_table, test, INSERT)) = test;

View File

@ -433,10 +433,10 @@ push_macro_expansion (const char *name, unsigned name_len,
if (strlen (macro_defs[ix].name) == name_len
&& !memcmp (name, macro_defs[ix].name, name_len))
{
macro_t *expansion = xmalloc (sizeof (*expansion));
macro_t *expansion = XNEW (macro_t);
expansion->next = macro_expns;
expansion->name = xmemdup (arg, arg_len, arg_len+1);
expansion->name = (char *) xmemdup (arg, arg_len, arg_len+1);
expansion->expansion = macro_defs[ix].expansion;
macro_expns = expansion;
return;

View File

@ -160,10 +160,10 @@ yacc_ids: /* empty */
{ $$ = NULL; }
| yacc_ids ID
{
pair_p p = xcalloc (1, sizeof (*p));
pair_p p = XCNEW (struct pair);
p->next = $1;
p->line = lexer_line;
p->opt = xmalloc (sizeof (*(p->opt)));
p->opt = XNEW (struct options);
p->opt->name = "tag";
p->opt->next = NULL;
p->opt->info = (char *)$2;
@ -171,10 +171,10 @@ yacc_ids: /* empty */
}
| yacc_ids CHAR
{
pair_p p = xcalloc (1, sizeof (*p));
pair_p p = XCNEW (struct pair);
p->next = $1;
p->line = lexer_line;
p->opt = xmalloc (sizeof (*(p->opt)));
p->opt = XNEW (struct options);
p->opt->name = "tag";
p->opt->next = NULL;
p->opt->info = xasprintf ("'%s'", $2);
@ -185,7 +185,7 @@ yacc_ids: /* empty */
struct_fields: { $$ = NULL; }
| type optionsopt ID bitfieldopt ';' struct_fields
{
pair_p p = xmalloc (sizeof (*p));
pair_p p = XNEW (struct pair);
p->type = adjust_field_type ($1, $2);
p->opt = $2;
p->name = $3;
@ -195,7 +195,7 @@ struct_fields: { $$ = NULL; }
}
| type optionsopt ID ARRAY ';' struct_fields
{
pair_p p = xmalloc (sizeof (*p));
pair_p p = XNEW (struct pair);
p->type = adjust_field_type (create_array ($1, $4), $2);
p->opt = $2;
p->name = $3;
@ -205,7 +205,7 @@ struct_fields: { $$ = NULL; }
}
| type optionsopt ID ARRAY ARRAY ';' struct_fields
{
pair_p p = xmalloc (sizeof (*p));
pair_p p = XNEW (struct pair);
p->type = create_array (create_array ($1, $5), $4);
p->opt = $2;
p->name = $3;
@ -314,7 +314,7 @@ stringseq: STRING
{
size_t l1 = strlen ($1);
size_t l2 = strlen ($2);
char *s = xrealloc ((char *)$1, l1 + l2 + 1);
char *s = (char *) xrealloc ((char *)$1, l1 + l2 + 1);
memcpy (s + l1, $2, l2 + 1);
free ((void *)$2);
$$ = s;

View File

@ -117,7 +117,7 @@ do_typedef (const char *s, type_p t, struct fileloc *pos)
return;
}
p = xmalloc (sizeof (struct pair));
p = XNEW (struct pair);
p->next = typedefs;
p->name = s;
p->type = t;
@ -173,7 +173,7 @@ new_structure (const char *name, int isunion, struct fileloc *pos,
else if (si->u.s.line.file != NULL && si->u.s.bitmap != bitmap)
{
ls = si;
si = xcalloc (1, sizeof (struct type));
si = XCNEW (struct type);
memcpy (si, ls, sizeof (struct type));
ls->kind = TYPE_LANG_STRUCT;
ls->u.s.lang_struct = si;
@ -187,7 +187,7 @@ new_structure (const char *name, int isunion, struct fileloc *pos,
if (ls != NULL && s == NULL)
{
s = xcalloc (1, sizeof (struct type));
s = XCNEW (struct type);
s->next = ls->u.s.lang_struct;
ls->u.s.lang_struct = s;
s->u.s.lang_struct = ls;
@ -197,7 +197,7 @@ new_structure (const char *name, int isunion, struct fileloc *pos,
if (s == NULL)
{
s = xcalloc (1, sizeof (struct type));
s = XCNEW (struct type);
s->next = structures;
structures = s;
}
@ -233,7 +233,7 @@ find_structure (const char *name, int isunion)
&& UNION_P (s) == isunion)
return s;
s = xcalloc (1, sizeof (struct type));
s = XCNEW (struct type);
s->next = structures;
structures = s;
s->kind = isunion ? TYPE_UNION : TYPE_STRUCT;
@ -258,7 +258,7 @@ find_param_structure (type_p t, type_p param[NUM_PARAM])
break;
if (res == NULL)
{
res = xcalloc (1, sizeof (*res));
res = XCNEW (struct type);
res->kind = TYPE_PARAM_STRUCT;
res->next = param_structs;
param_structs = res;
@ -273,9 +273,9 @@ find_param_structure (type_p t, type_p param[NUM_PARAM])
type_p
create_scalar_type (const char *name, size_t name_len)
{
type_p r = xcalloc (1, sizeof (struct type));
type_p r = XCNEW (struct type);
r->kind = TYPE_SCALAR;
r->u.sc = xmemdup (name, name_len, name_len + 1);
r->u.sc = (char *) xmemdup (name, name_len, name_len + 1);
return r;
}
@ -286,7 +286,7 @@ create_pointer (type_p t)
{
if (! t->pointer_to)
{
type_p r = xcalloc (1, sizeof (struct type));
type_p r = XCNEW (struct type);
r->kind = TYPE_POINTER;
r->u.p = t;
t->pointer_to = r;
@ -301,7 +301,7 @@ create_array (type_p t, const char *len)
{
type_p v;
v = xcalloc (1, sizeof (*v));
v = XCNEW (struct type);
v->kind = TYPE_ARRAY;
v->u.a.p = t;
v->u.a.len = len;
@ -312,7 +312,7 @@ create_array (type_p t, const char *len)
options_p
create_option (const char *name, void *info)
{
options_p o = xmalloc (sizeof (*o));
options_p o = XNEW (struct options);
o->name = name;
o->info = info;
return o;
@ -325,7 +325,7 @@ void
note_variable (const char *s, type_p t, options_p o, struct fileloc *pos)
{
pair_p n;
n = xmalloc (sizeof (*n));
n = XNEW (struct pair);
n->name = s;
n->type = t;
n->line = *pos;
@ -412,7 +412,7 @@ adjust_field_rtx_def (type_p t, options_p ARG_UNUSED (opt))
return &string_type;
}
nodot = xmalloc (sizeof (*nodot));
nodot = XNEW (struct options);
nodot->next = NULL;
nodot->name = "dot";
nodot->info = "";
@ -434,10 +434,10 @@ adjust_field_rtx_def (type_p t, options_p ARG_UNUSED (opt))
{
pair_p old_note_flds = note_flds;
note_flds = xmalloc (sizeof (*note_flds));
note_flds = XNEW (struct pair);
note_flds->line.file = __FILE__;
note_flds->line.line = __LINE__;
note_flds->opt = xmalloc (sizeof (*note_flds->opt));
note_flds->opt = XNEW (struct options);
note_flds->opt->next = nodot;
note_flds->opt->name = "tag";
note_flds->opt->info = xasprintf ("%d", c);
@ -586,7 +586,7 @@ adjust_field_rtx_def (type_p t, options_p ARG_UNUSED (opt))
break;
}
subfields = xmalloc (sizeof (*subfields));
subfields = XNEW (struct pair);
subfields->next = old_subf;
subfields->type = t;
subfields->name = xasprintf (".fld[%lu].%s", (unsigned long)aindex,
@ -595,7 +595,7 @@ adjust_field_rtx_def (type_p t, options_p ARG_UNUSED (opt))
subfields->line.line = __LINE__;
if (t == note_union_tp)
{
subfields->opt = xmalloc (sizeof (*subfields->opt));
subfields->opt = XNEW (struct options);
subfields->opt->next = nodot;
subfields->opt->name = "desc";
subfields->opt->info = "NOTE_LINE_NUMBER (&%0)";
@ -603,7 +603,7 @@ adjust_field_rtx_def (type_p t, options_p ARG_UNUSED (opt))
else if (t == basic_block_tp)
{
/* We don't presently GC basic block structures... */
subfields->opt = xmalloc (sizeof (*subfields->opt));
subfields->opt = XNEW (struct options);
subfields->opt->next = nodot;
subfields->opt->name = "skip";
subfields->opt->info = NULL;
@ -612,7 +612,7 @@ adjust_field_rtx_def (type_p t, options_p ARG_UNUSED (opt))
subfields->opt = nodot;
}
flds = xmalloc (sizeof (*flds));
flds = XNEW (struct pair);
flds->next = old_flds;
flds->name = "";
sname = xasprintf ("rtx_def_%s", rtx_name[i]);
@ -620,7 +620,7 @@ adjust_field_rtx_def (type_p t, options_p ARG_UNUSED (opt))
flds->type = find_structure (sname, 0);
flds->line.file = __FILE__;
flds->line.line = __LINE__;
flds->opt = xmalloc (sizeof (*flds->opt));
flds->opt = XNEW (struct options);
flds->opt->next = nodot;
flds->opt->name = "tag";
ftag = xstrdup (rtx_name[i]);
@ -652,24 +652,24 @@ adjust_field_tree_exp (type_p t, options_p opt ATTRIBUTE_UNUSED)
return &string_type;
}
nodot = xmalloc (sizeof (*nodot));
nodot = XNEW (struct options);
nodot->next = NULL;
nodot->name = "dot";
nodot->info = "";
flds = xmalloc (sizeof (*flds));
flds = XNEW (struct pair);
flds->next = NULL;
flds->name = "";
flds->type = t;
flds->line.file = __FILE__;
flds->line.line = __LINE__;
flds->opt = xmalloc (sizeof (*flds->opt));
flds->opt = XNEW (struct options);
flds->opt->next = nodot;
flds->opt->name = "length";
flds->opt->info = "TREE_CODE_LENGTH (TREE_CODE ((tree) &%0))";
{
options_p oldopt = flds->opt;
flds->opt = xmalloc (sizeof (*flds->opt));
flds->opt = XNEW (struct options);
flds->opt->next = oldopt;
flds->opt->name = "default";
flds->opt->info = "";
@ -998,7 +998,7 @@ create_file (const char *name, const char *oname)
outf_p f;
size_t i;
f = xcalloc (sizeof (*f), 1);
f = XCNEW (struct outf);
f->next = output_files;
f->name = oname;
output_files = f;
@ -1028,7 +1028,7 @@ oprintf (outf_p o, const char *format, ...)
do {
new_len *= 2;
} while (o->bufused + slength >= new_len);
o->buf = xrealloc (o->buf, new_len);
o->buf = (char *) xrealloc (o->buf, new_len);
o->buflength = new_len;
}
memcpy (o->buf + o->bufused, s, slength);
@ -2716,7 +2716,7 @@ write_roots (pair_p variables)
break;
if (fli == NULL)
{
fli = xmalloc (sizeof (*fli));
fli = XNEW (struct flist);
fli->f = f;
fli->next = flp;
fli->started_p = 0;

View File

@ -226,7 +226,7 @@ new_adjust (const char *name,
return;
}
a = xmalloc (sizeof (struct mode_adjust));
a = XNEW (struct mode_adjust);
a->mode = mode;
a->adjustment = adjustment;
a->file = file;

View File

@ -144,7 +144,7 @@ static struct queue_elem *
queue_pattern (rtx pattern, struct queue_elem ***list_tail,
const char *filename, int lineno)
{
struct queue_elem *e = xmalloc (sizeof (*e));
struct queue_elem *e = XNEW(struct queue_elem);
e->data = pattern;
e->filename = filename;
e->lineno = lineno;
@ -594,7 +594,7 @@ alter_predicate_for_insn (rtx pattern, int alt, int max_op, int lineno)
{
size_t c_len = strlen (c);
size_t len = alt * (c_len + 1);
char *new_c = xmalloc (len);
char *new_c = XNEWVEC(char, len);
memcpy (new_c, c, c_len);
for (i = 1; i < alt; ++i)
@ -887,7 +887,7 @@ process_define_cond_exec (void)
static char *
save_string (const char *s, int len)
{
char *result = xmalloc (len + 1);
char *result = XNEWVEC (char, len + 1);
memcpy (result, s, len);
result[len] = 0;
@ -921,7 +921,7 @@ init_md_reader_args (int argc, char **argv)
{
struct file_name_list *dirtmp;
dirtmp = xmalloc (sizeof (struct file_name_list));
dirtmp = XNEW (struct file_name_list);
dirtmp->next = 0; /* New one goes on the end */
if (first_dir_md_include == 0)
first_dir_md_include = dirtmp;
@ -1122,7 +1122,7 @@ maybe_eval_c_test (const char *expr)
return -1;
dummy.expr = expr;
test = htab_find (condition_table, &dummy);
test = (const struct c_test *)htab_find (condition_table, &dummy);
if (!test)
abort ();

View File

@ -439,10 +439,10 @@ read_constants (FILE *infile, char *tmp_char)
if (c != '(')
fatal_expected_char (infile, '(', c);
def = xmalloc (sizeof (struct md_constant));
def = XNEW (struct md_constant);
def->name = tmp_char;
read_name (tmp_char, infile);
entry_ptr = htab_find_slot (defs, def, TRUE);
entry_ptr = htab_find_slot (defs, def, INSERT);
if (! *entry_ptr)
def->name = xstrdup (tmp_char);
c = read_skip_spaces (infile);