patchlet checked into cp/ for better libiberty usage

Kaveh R. Ghazi ghaziATcaip.rutgers.edu
Thu Sep 16 15:34:00 GMT 1999


	I checked in the following patchlet to make better use of
libiberty in the cp dir.

		--Kaveh

Index: ChangeLog
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/ChangeLog,v
retrieving revision 1.1289
diff -u -p -r1.1289 ChangeLog
--- ChangeLog	1999/09/16 18:54:23	1.1289
+++ ChangeLog	1999/09/16 22:30:57
@@ -1,3 +1,9 @@
+1999-09-16  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+	* lex.c (init_cpp_parse): Call xcalloc, not malloc/bzero.
+
+	* xref.c (SALLOC): Call xstrdup, not xmalloc/strcpy.
+
 1999-09-16  Jason Merrill  <jason@yorick.cygnus.com>
 
 	* decl2.c (finish_file): Also call check_global_declarations for
Index: lex.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/lex.c,v
retrieving revision 1.151
diff -u -p -r1.151 lex.c
--- lex.c	1999/09/16 00:02:09	1.151
+++ lex.c	1999/09/16 22:31:00
@@ -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
Index: xref.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/xref.c,v
retrieving revision 1.20
diff -u -p -r1.20 xref.c
--- xref.c	1999/08/31 00:55:39	1.20
+++ xref.c	1999/09/16 22:31:01
@@ -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)


More information about the Gcc-patches mailing list