From fffeac96e0bb41205011e6092116ff91f1049b17 Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Thu, 16 Sep 1999 22:33:10 +0000 Subject: [PATCH] lex.c (init_cpp_parse): Call xcalloc, not malloc/bzero. * lex.c (init_cpp_parse): Call xcalloc, not malloc/bzero. * xref.c (SALLOC): Call xstrdup, not xmalloc/strcpy. From-SVN: r29464 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/lex.c | 6 ++---- gcc/cp/xref.c | 4 +--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b88a629db87..7603401c4fc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +1999-09-16 Kaveh R. Ghazi + + * lex.c (init_cpp_parse): Call xcalloc, not malloc/bzero. + + * xref.c (SALLOC): Call xstrdup, not xmalloc/strcpy. + 1999-09-16 Jason Merrill * decl2.c (finish_file): Also call check_global_declarations for diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 77b5e3c23d4..e1a0c099ce1 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -508,11 +508,9 @@ init_cpp_parse () { #ifdef GATHER_STATISTICS #ifdef REDUCE_LENGTH - reduce_count = (int *)malloc (sizeof (int) * (REDUCE_LENGTH + 1)); - bzero (reduce_count, sizeof (int) * (REDUCE_LENGTH + 1)); + reduce_count = (int *) xcalloc (sizeof (int), (REDUCE_LENGTH + 1)); reduce_count += 1; - token_count = (int *)malloc (sizeof (int) * (TOKEN_LENGTH + 1)); - bzero (token_count, sizeof (int) * (TOKEN_LENGTH + 1)); + token_count = (int *) xcalloc (sizeof (int), (TOKEN_LENGTH + 1)); token_count += 1; #endif #endif diff --git a/gcc/cp/xref.c b/gcc/cp/xref.c index cd6cb85c7d4..5c6e7b787a3 100644 --- a/gcc/cp/xref.c +++ b/gcc/cp/xref.c @@ -60,9 +60,7 @@ int flag_gnu_xref; /* Return a malloc'd copy of STR. */ -#define SALLOC(str) \ - ((char *) ((str) == NULL ? NULL \ - : (char *) strcpy ((char *) xmalloc (strlen ((str)) + 1), (str)))) +#define SALLOC(str) ((char *) ((str) == NULL ? NULL : xstrdup (str))) #define SFREE(str) (str != NULL && (free(str),0)) #define STREQL(s1,s2) (strcmp((s1),(s2)) == 0)