Commit efd59a33 by Kaveh R. Ghazi Committed by Kaveh Ghazi

cccp.c (xstrdup): Renamed from `savestring'.

        * cccp.c (xstrdup): Renamed from `savestring'.  All callers changed.
        Remove prototype which we get from libiberty.h.
        * collect2.c (xstrdup): Likewise.
        * genextract.c (xstrdup): Likewise for `copystr'.
        (mybzero): Remove it and use `memset' instead.
        * genoutput.c (mybcopy, mybzero): Remove these.  All callers changed
        to use `memcpy' and `memset' instead.
        * genrecog.c (xstrdup): Renamed from `copystr'.  All callers
        changed.  Remove prototype.
        (mybcopy, mybzero): Remove these and use memcpy/memset.

From-SVN: r24650
parent 96847892
Wed Jan 13 13:30:08 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* cccp.c (xstrdup): Renamed from `savestring'. All callers changed.
Remove prototype which we get from libiberty.h.
* collect2.c (xstrdup): Likewise.
* genextract.c (xstrdup): Likewise for `copystr'.
(mybzero): Remove it and use `memset' instead.
* genoutput.c (mybcopy, mybzero): Remove these. All callers changed
to use `memcpy' and `memset' instead.
* genrecog.c (xstrdup): Renamed from `copystr'. All callers
changed. Remove prototype.
(mybcopy, mybzero): Remove these and use memcpy/memset.
Wed Jan 13 00:59:04 1999 Jeffrey A Law (law@cygnus.com) Wed Jan 13 00:59:04 1999 Jeffrey A Law (law@cygnus.com)
* mips.h (LOAD_EXTEND_OP): Correct for SImode and CCmode moves when * mips.h (LOAD_EXTEND_OP): Correct for SImode and CCmode moves when
......
...@@ -1042,7 +1042,6 @@ static void pfatal_with_name PROTO((char *)) __attribute__ ((noreturn)); ...@@ -1042,7 +1042,6 @@ static void pfatal_with_name PROTO((char *)) __attribute__ ((noreturn));
static void pipe_closed PROTO((int)) __attribute__ ((noreturn)); static void pipe_closed PROTO((int)) __attribute__ ((noreturn));
static void memory_full PROTO((void)) __attribute__ ((noreturn)); static void memory_full PROTO((void)) __attribute__ ((noreturn));
static char *savestring PROTO((char *));
static void print_help PROTO((void)); static void print_help PROTO((void));
/* Read LEN bytes at PTR from descriptor DESC, for file FILENAME, /* Read LEN bytes at PTR from descriptor DESC, for file FILENAME,
...@@ -1276,7 +1275,7 @@ main (argc, argv) ...@@ -1276,7 +1275,7 @@ main (argc, argv)
{ {
/* Remove extension from PROGNAME. */ /* Remove extension from PROGNAME. */
char *p; char *p;
char *s = progname = savestring (progname); char *s = progname = xstrdup (progname);
if ((p = rindex (s, ';')) != 0) *p = '\0'; /* strip version number */ if ((p = rindex (s, ';')) != 0) *p = '\0'; /* strip version number */
if ((p = rindex (s, '.')) != 0 /* strip type iff ".exe" */ if ((p = rindex (s, '.')) != 0 /* strip type iff ".exe" */
...@@ -1378,7 +1377,7 @@ main (argc, argv) ...@@ -1378,7 +1377,7 @@ main (argc, argv)
if (include_prefix != 0) if (include_prefix != 0)
prefix = include_prefix; prefix = include_prefix;
else { else {
prefix = savestring (GCC_INCLUDE_DIR); prefix = xstrdup (GCC_INCLUDE_DIR);
/* Remove the `include' from /usr/local/lib/gcc.../include. */ /* Remove the `include' from /usr/local/lib/gcc.../include. */
if (!strcmp (prefix + strlen (prefix) - 8, "/include")) if (!strcmp (prefix + strlen (prefix) - 8, "/include"))
prefix[strlen (prefix) - 7] = 0; prefix[strlen (prefix) - 7] = 0;
...@@ -1403,7 +1402,7 @@ main (argc, argv) ...@@ -1403,7 +1402,7 @@ main (argc, argv)
if (include_prefix != 0) if (include_prefix != 0)
prefix = include_prefix; prefix = include_prefix;
else { else {
prefix = savestring (GCC_INCLUDE_DIR); prefix = xstrdup (GCC_INCLUDE_DIR);
/* Remove the `include' from /usr/local/lib/gcc.../include. */ /* Remove the `include' from /usr/local/lib/gcc.../include. */
if (!strcmp (prefix + strlen (prefix) - 8, "/include")) if (!strcmp (prefix + strlen (prefix) - 8, "/include"))
prefix[strlen (prefix) - 7] = 0; prefix[strlen (prefix) - 7] = 0;
...@@ -1977,7 +1976,7 @@ main (argc, argv) ...@@ -1977,7 +1976,7 @@ main (argc, argv)
if (c == PATH_SEPARATOR || !c) { if (c == PATH_SEPARATOR || !c) {
endp[-1] = 0; endp[-1] = 0;
include_defaults[num_dirs].fname include_defaults[num_dirs].fname
= startp == endp ? "." : savestring (startp); = startp == endp ? "." : xstrdup (startp);
endp[-1] = c; endp[-1] = c;
include_defaults[num_dirs].component = 0; include_defaults[num_dirs].component = 0;
include_defaults[num_dirs].cplusplus = cplusplus; include_defaults[num_dirs].cplusplus = cplusplus;
...@@ -2003,7 +2002,7 @@ main (argc, argv) ...@@ -2003,7 +2002,7 @@ main (argc, argv)
if (!no_standard_includes) { if (!no_standard_includes) {
struct default_include *p = include_defaults; struct default_include *p = include_defaults;
char *specd_prefix = include_prefix; char *specd_prefix = include_prefix;
char *default_prefix = savestring (GCC_INCLUDE_DIR); char *default_prefix = xstrdup (GCC_INCLUDE_DIR);
int default_len = 0; int default_len = 0;
/* Remove the `include' from /usr/local/lib/gcc.../include. */ /* Remove the `include' from /usr/local/lib/gcc.../include. */
if (!strcmp (default_prefix + strlen (default_prefix) - 8, "/include")) { if (!strcmp (default_prefix + strlen (default_prefix) - 8, "/include")) {
...@@ -5067,7 +5066,7 @@ read_name_map (dirname) ...@@ -5067,7 +5066,7 @@ read_name_map (dirname)
map_list_ptr = ((struct file_name_map_list *) map_list_ptr = ((struct file_name_map_list *)
xmalloc (sizeof (struct file_name_map_list))); xmalloc (sizeof (struct file_name_map_list)));
map_list_ptr->map_list_name = savestring (dirname); map_list_ptr->map_list_name = xstrdup (dirname);
map_list_ptr->map_list_map = NULL; map_list_ptr->map_list_map = NULL;
dirlen = strlen (dirname); dirlen = strlen (dirname);
...@@ -10762,13 +10761,13 @@ xcalloc (number, size) ...@@ -10762,13 +10761,13 @@ xcalloc (number, size)
return ptr; return ptr;
} }
static char * char *
savestring (input) xstrdup (input)
char *input; const char *input;
{ {
size_t size = strlen (input); register size_t len = strlen (input) + 1;
char *output = xmalloc (size + 1); register char *output = xmalloc (len);
strcpy (output, input); memcpy (output, input, len);
return output; return output;
} }
......
/* Collect static initialization info into data structures that can be /* Collect static initialization info into data structures that can be
traversed by C++ initialization and finalization routines. traversed by C++ initialization and finalization routines.
Copyright (C) 1992, 93-97, 1998 Free Software Foundation, Inc. Copyright (C) 1992, 93-98, 1999 Free Software Foundation, Inc.
Contributed by Chris Smith (csmith@convex.com). Contributed by Chris Smith (csmith@convex.com).
Heavily modified by Michael Meissner (meissner@cygnus.com), Heavily modified by Michael Meissner (meissner@cygnus.com),
Per Bothner (bothner@cygnus.com), and John Gilmore (gnu@cygnus.com). Per Bothner (bothner@cygnus.com), and John Gilmore (gnu@cygnus.com).
...@@ -551,13 +551,12 @@ file_exists (name) ...@@ -551,13 +551,12 @@ file_exists (name)
/* Make a copy of a string INPUT with size SIZE. */ /* Make a copy of a string INPUT with size SIZE. */
char * char *
savestring (input, size) xstrdup (input)
char *input; const char *input;
int size;
{ {
char *output = (char *) xmalloc (size + 1); register size_t len = strlen (input) + 1;
bcopy (input, output, size); register char *output = xmalloc (len);
output[size] = 0; memcpy (output, input, len);
return output; return output;
} }
...@@ -874,7 +873,7 @@ add_prefix (pprefix, prefix) ...@@ -874,7 +873,7 @@ add_prefix (pprefix, prefix)
pprefix->max_len = len; pprefix->max_len = len;
pl = (struct prefix_list *) xmalloc (sizeof (struct prefix_list)); pl = (struct prefix_list *) xmalloc (sizeof (struct prefix_list));
pl->prefix = savestring (prefix, len); pl->prefix = xstrdup (prefix);
if (*prev) if (*prev)
pl->next = *prev; pl->next = *prev;
......
/* Generate code from machine description to extract operands from insn as rtl. /* Generate code from machine description to extract operands from insn as rtl.
Copyright (C) 1987, 91, 92, 93, 97, 1998 Free Software Foundation, Inc. Copyright (C) 1987, 91-93, 97-98, 1999 Free Software Foundation, Inc.
This file is part of GNU CC. This file is part of GNU CC.
...@@ -100,8 +100,6 @@ static void walk_rtx PROTO ((rtx, const char *)); ...@@ -100,8 +100,6 @@ static void walk_rtx PROTO ((rtx, const char *));
static void print_path PROTO ((char *)); static void print_path PROTO ((char *));
static void fatal PVPROTO ((const char *, ...)) static void fatal PVPROTO ((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
static char *copystr PROTO ((const char *));
static void mybzero ();
void fancy_abort PROTO ((void)) ATTRIBUTE_NORETURN; void fancy_abort PROTO ((void)) ATTRIBUTE_NORETURN;
static void static void
...@@ -116,7 +114,7 @@ gen_insn (insn) ...@@ -116,7 +114,7 @@ gen_insn (insn)
dup_count = 0; dup_count = 0;
/* No operands seen so far in this pattern. */ /* No operands seen so far in this pattern. */
mybzero (oplocs, sizeof oplocs); memset (oplocs, 0, sizeof oplocs);
/* Walk the insn's pattern, remembering at all times the path /* Walk the insn's pattern, remembering at all times the path
down to the walking point. */ down to the walking point. */
...@@ -211,19 +209,19 @@ walk_rtx (x, path) ...@@ -211,19 +209,19 @@ walk_rtx (x, path)
case MATCH_OPERAND: case MATCH_OPERAND:
case MATCH_SCRATCH: case MATCH_SCRATCH:
oplocs[XINT (x, 0)] = copystr (path); oplocs[XINT (x, 0)] = xstrdup (path);
op_count = MAX (op_count, XINT (x, 0) + 1); op_count = MAX (op_count, XINT (x, 0) + 1);
break; break;
case MATCH_DUP: case MATCH_DUP:
case MATCH_PAR_DUP: case MATCH_PAR_DUP:
duplocs[dup_count] = copystr (path); duplocs[dup_count] = xstrdup (path);
dupnums[dup_count] = XINT (x, 0); dupnums[dup_count] = XINT (x, 0);
dup_count++; dup_count++;
break; break;
case MATCH_OP_DUP: case MATCH_OP_DUP:
duplocs[dup_count] = copystr (path); duplocs[dup_count] = xstrdup (path);
dupnums[dup_count] = XINT (x, 0); dupnums[dup_count] = XINT (x, 0);
dup_count++; dup_count++;
...@@ -239,7 +237,7 @@ walk_rtx (x, path) ...@@ -239,7 +237,7 @@ walk_rtx (x, path)
return; return;
case MATCH_OPERATOR: case MATCH_OPERATOR:
oplocs[XINT (x, 0)] = copystr (path); oplocs[XINT (x, 0)] = xstrdup (path);
op_count = MAX (op_count, XINT (x, 0) + 1); op_count = MAX (op_count, XINT (x, 0) + 1);
newpath = (char *) alloca (depth + 2); newpath = (char *) alloca (depth + 2);
...@@ -254,7 +252,7 @@ walk_rtx (x, path) ...@@ -254,7 +252,7 @@ walk_rtx (x, path)
return; return;
case MATCH_PARALLEL: case MATCH_PARALLEL:
oplocs[XINT (x, 0)] = copystr (path); oplocs[XINT (x, 0)] = xstrdup (path);
op_count = MAX (op_count, XINT (x, 0) + 1); op_count = MAX (op_count, XINT (x, 0) + 1);
newpath = (char *) alloca (depth + 2); newpath = (char *) alloca (depth + 2);
...@@ -398,28 +396,14 @@ fancy_abort () ...@@ -398,28 +396,14 @@ fancy_abort ()
fatal ("Internal gcc abort."); fatal ("Internal gcc abort.");
} }
static char * char *
copystr (s1) xstrdup (s1)
const char *s1; const char *input;
{ {
register char *tem; register size_t len = strlen (input) + 1;
register char *output = xmalloc (len);
if (s1 == 0) memcpy (output, input, len);
return 0; return output;
tem = (char *) xmalloc (strlen (s1) + 1);
strcpy (tem, s1);
return tem;
}
static void
mybzero (b, length)
register char *b;
register unsigned length;
{
while (length-- > 0)
*b++ = 0;
} }
int int
......
/* Generate code from to output assembler insns as recognized from rtl. /* Generate code from to output assembler insns as recognized from rtl.
Copyright (C) 1987, 88, 92, 94, 95, 97, 1998 Free Software Foundation, Inc. Copyright (C) 1987, 88, 92, 94-95, 97-98, 1999 Free Software Foundation, Inc.
This file is part of GNU CC. This file is part of GNU CC.
...@@ -111,8 +111,6 @@ static void fatal PVPROTO ((const char *, ...)) ...@@ -111,8 +111,6 @@ static void fatal PVPROTO ((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN; void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
static void error PVPROTO ((const char *, ...)) ATTRIBUTE_PRINTF_1; static void error PVPROTO ((const char *, ...)) ATTRIBUTE_PRINTF_1;
static void mybcopy ();
static void mybzero ();
static int n_occurrences PROTO((int, char *)); static int n_occurrences PROTO((int, char *));
/* Define this so we can link with print-rtl.o to get debug_rtx function. */ /* Define this so we can link with print-rtl.o to get debug_rtx function. */
...@@ -684,13 +682,13 @@ gen_insn (insn) ...@@ -684,13 +682,13 @@ gen_insn (insn)
max_opno = -1; max_opno = -1;
num_dups = 0; num_dups = 0;
mybzero (constraints, sizeof constraints); memset (constraints, 0, sizeof constraints);
mybzero (op_n_alternatives, sizeof op_n_alternatives); memset (op_n_alternatives, 0, sizeof op_n_alternatives);
mybzero (predicates, sizeof predicates); memset (predicates, 0, sizeof predicates);
mybzero (address_p, sizeof address_p); memset (address_p, 0, sizeof address_p);
mybzero (modes, sizeof modes); memset (modes, 0, sizeof modes);
mybzero (strict_low, sizeof strict_low); memset (strict_low, 0, sizeof strict_low);
mybzero (seen, sizeof seen); memset (seen, 0, sizeof seen);
for (i = 0; i < XVECLEN (insn, 1); i++) for (i = 0; i < XVECLEN (insn, 1); i++)
scan_operands (XVECEXP (insn, 1, i), 0, 0); scan_operands (XVECEXP (insn, 1, i), 0, 0);
...@@ -698,12 +696,12 @@ gen_insn (insn) ...@@ -698,12 +696,12 @@ gen_insn (insn)
d->n_operands = max_opno + 1; d->n_operands = max_opno + 1;
d->n_dups = num_dups; d->n_dups = num_dups;
mybcopy (constraints, d->constraints, sizeof constraints); memcpy (d->constraints, constraints, sizeof constraints);
mybcopy (op_n_alternatives, d->op_n_alternatives, sizeof op_n_alternatives); memcpy (d->op_n_alternatives, op_n_alternatives, sizeof op_n_alternatives);
mybcopy (predicates, d->predicates, sizeof predicates); memcpy (d->predicates, predicates, sizeof predicates);
mybcopy (address_p, d->address_p, sizeof address_p); memcpy (d->address_p, address_p, sizeof address_p);
mybcopy (modes, d->modes, sizeof modes); memcpy (d->modes, modes, sizeof modes);
mybcopy (strict_low, d->strict_low, sizeof strict_low); memcpy (d->strict_low, strict_low, sizeof strict_low);
validate_insn_alternatives (d); validate_insn_alternatives (d);
process_template (d, XSTR (insn, 3)); process_template (d, XSTR (insn, 3));
...@@ -735,13 +733,13 @@ gen_peephole (peep) ...@@ -735,13 +733,13 @@ gen_peephole (peep)
end_of_insn_data = d; end_of_insn_data = d;
max_opno = -1; max_opno = -1;
mybzero (constraints, sizeof constraints); memset (constraints, 0, sizeof constraints);
mybzero (op_n_alternatives, sizeof op_n_alternatives); memset (op_n_alternatives, 0, sizeof op_n_alternatives);
mybzero (predicates, sizeof predicates); memset (predicates, 0, sizeof predicates);
mybzero (address_p, sizeof address_p); memset (address_p, 0, sizeof address_p);
mybzero (modes, sizeof modes); memset (modes, 0, sizeof modes);
mybzero (strict_low, sizeof strict_low); memset (strict_low, 0, sizeof strict_low);
mybzero (seen, sizeof seen); memset (seen, 0, sizeof seen);
/* Get the number of operands by scanning all the /* Get the number of operands by scanning all the
patterns of the peephole optimizer. patterns of the peephole optimizer.
...@@ -752,12 +750,12 @@ gen_peephole (peep) ...@@ -752,12 +750,12 @@ gen_peephole (peep)
d->n_operands = max_opno + 1; d->n_operands = max_opno + 1;
d->n_dups = 0; d->n_dups = 0;
mybcopy (constraints, d->constraints, sizeof constraints); memcpy (d->constraints, constraints, sizeof constraints);
mybcopy (op_n_alternatives, d->op_n_alternatives, sizeof op_n_alternatives); memcpy (d->op_n_alternatives, op_n_alternatives, sizeof op_n_alternatives);
mybzero (d->predicates, sizeof predicates); memset (d->predicates, 0, sizeof predicates);
mybzero (d->address_p, sizeof address_p); memset (d->address_p, 0, sizeof address_p);
mybzero (d->modes, sizeof modes); memset (d->modes, 0, sizeof modes);
mybzero (d->strict_low, sizeof strict_low); memset (d->strict_low, 0, sizeof strict_low);
validate_insn_alternatives (d); validate_insn_alternatives (d);
process_template (d, XSTR (peep, 2)); process_template (d, XSTR (peep, 2));
...@@ -796,13 +794,13 @@ gen_expand (insn) ...@@ -796,13 +794,13 @@ gen_expand (insn)
/* Scan the operands to get the specified predicates and modes, /* Scan the operands to get the specified predicates and modes,
since expand_binop needs to know them. */ since expand_binop needs to know them. */
mybzero (constraints, sizeof constraints); memset (constraints, 0, sizeof constraints);
mybzero (op_n_alternatives, sizeof op_n_alternatives); memset (op_n_alternatives, 0, sizeof op_n_alternatives);
mybzero (predicates, sizeof predicates); memset (predicates, 0, sizeof predicates);
mybzero (address_p, sizeof address_p); memset (address_p, 0, sizeof address_p);
mybzero (modes, sizeof modes); memset (modes, 0, sizeof modes);
mybzero (strict_low, sizeof strict_low); memset (strict_low, 0, sizeof strict_low);
mybzero (seen, sizeof seen); memset (seen, 0, sizeof seen);
if (XVEC (insn, 1)) if (XVEC (insn, 1))
for (i = 0; i < XVECLEN (insn, 1); i++) for (i = 0; i < XVECLEN (insn, 1); i++)
...@@ -811,12 +809,12 @@ gen_expand (insn) ...@@ -811,12 +809,12 @@ gen_expand (insn)
d->n_operands = max_opno + 1; d->n_operands = max_opno + 1;
d->n_dups = num_dups; d->n_dups = num_dups;
mybcopy (constraints, d->constraints, sizeof constraints); memcpy (d->constraints, constraints, sizeof constraints);
mybcopy (op_n_alternatives, d->op_n_alternatives, sizeof op_n_alternatives); memcpy (d->op_n_alternatives, op_n_alternatives, sizeof op_n_alternatives);
mybcopy (predicates, d->predicates, sizeof predicates); memcpy (d->predicates, predicates, sizeof predicates);
mybcopy (address_p, d->address_p, sizeof address_p); memcpy (d->address_p, address_p, sizeof address_p);
mybcopy (modes, d->modes, sizeof modes); memcpy (d->modes, modes, sizeof modes);
mybcopy (strict_low, d->strict_low, sizeof strict_low); memcpy (d->strict_low, strict_low, sizeof strict_low);
d->template = 0; d->template = 0;
d->outfun = 0; d->outfun = 0;
...@@ -851,13 +849,13 @@ gen_split (split) ...@@ -851,13 +849,13 @@ gen_split (split)
max_opno = -1; max_opno = -1;
num_dups = 0; num_dups = 0;
mybzero (constraints, sizeof constraints); memset (constraints, 0, sizeof constraints);
mybzero (op_n_alternatives, sizeof op_n_alternatives); memset (op_n_alternatives, 0, sizeof op_n_alternatives);
mybzero (predicates, sizeof predicates); memset (predicates, 0, sizeof predicates);
mybzero (address_p, sizeof address_p); memset (address_p, 0, sizeof address_p);
mybzero (modes, sizeof modes); memset (modes, 0, sizeof modes);
mybzero (strict_low, sizeof strict_low); memset (strict_low, 0, sizeof strict_low);
mybzero (seen, sizeof seen); memset (seen, 0, sizeof seen);
/* Get the number of operands by scanning all the /* Get the number of operands by scanning all the
patterns of the split patterns. patterns of the split patterns.
...@@ -867,12 +865,12 @@ gen_split (split) ...@@ -867,12 +865,12 @@ gen_split (split)
d->n_operands = max_opno + 1; d->n_operands = max_opno + 1;
mybzero (d->constraints, sizeof constraints); memset (d->constraints, 0, sizeof constraints);
mybzero (d->op_n_alternatives, sizeof op_n_alternatives); memset (d->op_n_alternatives, 0, sizeof op_n_alternatives);
mybzero (d->predicates, sizeof predicates); memset (d->predicates, 0, sizeof predicates);
mybzero (d->address_p, sizeof address_p); memset (d->address_p, 0, sizeof address_p);
mybzero (d->modes, sizeof modes); memset (d->modes, 0, sizeof modes);
mybzero (d->strict_low, sizeof strict_low); memset (d->strict_low, 0, sizeof strict_low);
d->n_dups = 0; d->n_dups = 0;
d->n_alternatives = 0; d->n_alternatives = 0;
...@@ -903,25 +901,6 @@ xrealloc (ptr, size) ...@@ -903,25 +901,6 @@ xrealloc (ptr, size)
} }
static void static void
mybzero (b, length)
register char *b;
register unsigned length;
{
while (length-- > 0)
*b++ = 0;
}
static void
mybcopy (b1, b2, length)
register char *b1;
register char *b2;
register unsigned length;
{
while (length-- > 0)
*b2++ = *b1++;
}
static void
fatal VPROTO ((const char *format, ...)) fatal VPROTO ((const char *format, ...))
{ {
#ifndef ANSI_PROTOTYPES #ifndef ANSI_PROTOTYPES
......
/* Generate code from machine description to recognize rtl as insns. /* Generate code from machine description to recognize rtl as insns.
Copyright (C) 1987, 88, 92, 93, 94, 95, 97, 98, 1999 Free Software Foundation, Inc. Copyright (C) 1987, 88, 92-95, 97-98, 1999 Free Software Foundation, Inc.
This file is part of GNU CC. This file is part of GNU CC.
...@@ -191,9 +191,6 @@ static void write_tree PROTO((struct decision *, const char *, ...@@ -191,9 +191,6 @@ static void write_tree PROTO((struct decision *, const char *,
struct decision *, int, struct decision *, int,
enum routine_type)); enum routine_type));
static void change_state PROTO((const char *, const char *, int)); static void change_state PROTO((const char *, const char *, int));
static char *copystr PROTO((const char *));
static void mybzero PROTO((char *, unsigned));
static void mybcopy PROTO((char *, char *, unsigned));
static void fatal PVPROTO((const char *, ...)) static void fatal PVPROTO((const char *, ...))
ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN; ATTRIBUTE_PRINTF_1 ATTRIBUTE_NORETURN;
void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN; void fancy_abort PROTO((void)) ATTRIBUTE_NORETURN;
...@@ -310,7 +307,7 @@ add_to_sequence (pattern, last, position) ...@@ -310,7 +307,7 @@ add_to_sequence (pattern, last, position)
max_depth = depth; max_depth = depth;
new->number = next_number++; new->number = next_number++;
new->position = copystr (position); new->position = xstrdup (position);
new->ignore_code = 0; new->ignore_code = 0;
new->ignore_mode = 0; new->ignore_mode = 0;
new->enforce_mode = 1; new->enforce_mode = 1;
...@@ -833,8 +830,7 @@ merge_trees (oldh, addh) ...@@ -833,8 +830,7 @@ merge_trees (oldh, addh)
struct decision *split struct decision *split
= (struct decision *) xmalloc (sizeof (struct decision)); = (struct decision *) xmalloc (sizeof (struct decision));
mybcopy ((char *) old, (char *) split, memcpy (split, old, sizeof (struct decision));
sizeof (struct decision));
old->success.first = old->success.last = split; old->success.first = old->success.last = split;
old->c_test = 0; old->c_test = 0;
...@@ -860,8 +856,7 @@ merge_trees (oldh, addh) ...@@ -860,8 +856,7 @@ merge_trees (oldh, addh)
struct decision *split struct decision *split
= (struct decision *) xmalloc (sizeof (struct decision)); = (struct decision *) xmalloc (sizeof (struct decision));
mybcopy ((char *) add, (char *) split, memcpy (split, add, sizeof (struct decision));
sizeof (struct decision));
add->success.first = add->success.last = split; add->success.first = add->success.last = split;
add->c_test = 0; add->c_test = 0;
...@@ -1300,7 +1295,7 @@ write_tree_1 (tree, prevpos, afterward, type) ...@@ -1300,7 +1295,7 @@ write_tree_1 (tree, prevpos, afterward, type)
if (switch_mode == VOIDmode && mode != VOIDmode && p->next != 0 if (switch_mode == VOIDmode && mode != VOIDmode && p->next != 0
&& p->next->enforce_mode && p->next->mode != VOIDmode) && p->next->enforce_mode && p->next->mode != VOIDmode)
{ {
mybzero (modemap, sizeof modemap); memset (modemap, 0, sizeof modemap);
printf ("%sswitch (GET_MODE (x%d))\n", indents[indent], depth); printf ("%sswitch (GET_MODE (x%d))\n", indents[indent], depth);
printf ("%s{\n", indents[indent + 2]); printf ("%s{\n", indents[indent + 2]);
indent += 4; indent += 4;
...@@ -1317,7 +1312,7 @@ write_tree_1 (tree, prevpos, afterward, type) ...@@ -1317,7 +1312,7 @@ write_tree_1 (tree, prevpos, afterward, type)
if (switch_code == UNKNOWN && p->code != UNKNOWN && ! p->ignore_code if (switch_code == UNKNOWN && p->code != UNKNOWN && ! p->ignore_code
&& p->next != 0 && p->next->code != UNKNOWN) && p->next != 0 && p->next->code != UNKNOWN)
{ {
mybzero (codemap, sizeof codemap); memset (codemap, 0, sizeof codemap);
printf ("%sswitch (GET_CODE (x%d))\n", indents[indent], depth); printf ("%sswitch (GET_CODE (x%d))\n", indents[indent], depth);
printf ("%s{\n", indents[indent + 2]); printf ("%s{\n", indents[indent + 2]);
indent += 4; indent += 4;
...@@ -1628,37 +1623,14 @@ change_state (oldpos, newpos, indent) ...@@ -1628,37 +1623,14 @@ change_state (oldpos, newpos, indent)
} }
} }
static char * char *
copystr (s1) xstrdup (s1)
const char *s1; const char *input;
{ {
register char *tem; register size_t len = strlen (input) + 1;
register char *output = xmalloc (len);
if (s1 == 0) memcpy (output, input, len);
return 0; return output;
tem = (char *) xmalloc (strlen (s1) + 1);
strcpy (tem, s1);
return tem;
}
static void
mybzero (b, length)
register char *b;
register unsigned length;
{
while (length-- > 0)
*b++ = 0;
}
static void
mybcopy (in, out, length)
register char *in, *out;
register unsigned length;
{
while (length-- > 0)
*out++ = *in++;
} }
PTR PTR
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment