From c25294ad3ba1252a0d77bf63a27758a0eee4259e Mon Sep 17 00:00:00 2001 From: Paul Smith Date: Sun, 9 Apr 2006 22:09:24 +0000 Subject: Another round of cleanups: - Add more warnings. - Rename variables that mask out-scope vars with the same name. - Remove all casts of return values from xmalloc, xrealloc, and alloca. - Remove casts of the first argument to xrealloc. - Convert all bcopy/bzero/bcmp invocations to use memcp/memmove/memset/memcmp. --- make.h | 43 ++++++++----------------------------------- 1 file changed, 8 insertions(+), 35 deletions(-) (limited to 'make.h') diff --git a/make.h b/make.h index 5914dd8..949f35a 100644 --- a/make.h +++ b/make.h @@ -141,7 +141,7 @@ extern int errno; #else # define NEED_GET_PATH_MAX 1 # define GET_PATH_MAX (get_path_max ()) -# define PATH_VAR(var) char *var = (char *) alloca (GET_PATH_MAX) +# define PATH_VAR(var) char *var = alloca (GET_PATH_MAX) unsigned int get_path_max (void); #endif @@ -218,9 +218,9 @@ unsigned int get_path_max (void); # ifdef HAVE_STDLIB_H # include # else -char *malloc (int); -char *realloc (char *, int); -void free (char *); +void *malloc (int); +void *realloc (void *, int); +void free (void *); void abort (void) __attribute__ ((noreturn)); void exit (int) __attribute__ ((noreturn)); @@ -233,37 +233,10 @@ void exit (int) __attribute__ ((noreturn)); # define EXIT_SUCCESS 0 #endif #ifndef EXIT_FAILURE -# define EXIT_FAILURE 0 +# define EXIT_FAILURE 1 #endif -#ifdef ANSI_STRING - -# ifndef bcmp -# define bcmp(s1, s2, n) memcmp ((s1), (s2), (n)) -# endif -# ifndef bzero -# define bzero(s, n) memset ((s), 0, (n)) -# endif -# if defined(HAVE_MEMMOVE) && !defined(bcopy) -# define bcopy(s, d, n) memmove ((d), (s), (n)) -# endif - -#else /* Not ANSI_STRING. */ - -# ifndef HAVE_STRCHR -# define strchr(s, c) index((s), (c)) -# define strrchr(s, c) rindex((s), (c)) -# endif - -# ifndef bcmp -int bcmp (const char *, const char *, int); -# endif -# ifndef bzero -void bzero (char *, int); -#endif -# ifndef bcopy -void bcopy (const char *b1, char *b2, int); -# endif +#ifndef ANSI_STRING /* SCO Xenix has a buggy macro definition in . */ #undef strerror @@ -407,8 +380,8 @@ void pfatal_with_name (const char *) __attribute__ ((noreturn)); void perror_with_name (const char *, const char *); char *savestring (const char *, unsigned int); char *concat (const char *, const char *, const char *); -char *xmalloc (unsigned int); -char *xrealloc (char *, unsigned int); +void *xmalloc (unsigned int); +void *xrealloc (void *, unsigned int); char *xstrdup (const char *); char *find_next_token (char **, unsigned int *); char *next_token (const char *); -- cgit v1.2.3