Commit d11ec6f0 by Zack Weinberg Committed by Zack Weinberg

hashtab.c, [...]: Include string.h if HAVE_STRING_H.

	* hashtab.c, partition.c, sort.c, xmemdup.c: Include string.h
	if HAVE_STRING_H.
	* pexecute.c, xexit.c: Include stdlib.h if HAVE_STDLIB_H.
	* objalloc.c: Include config.h.  Include stdlib.h and don't
	declare malloc or free if HAVE_STDLIB_H.
	* strerror.c, strsignal.c: Include stdlib.h if HAVE_STDLIB_H,
	else declare malloc without prototype.  Include string.h if
	HAVE_STRING_H, else declare memset without prototype.  Don't
	include stddef.h.

From-SVN: r34254
parent ea4a453b
2000-05-29 Zack Weinberg <zack@wolery.cumb.org>
* hashtab.c, partition.c, sort.c, xmemdup.c: Include string.h
if HAVE_STRING_H.
* pexecute.c, xexit.c: Include stdlib.h if HAVE_STDLIB_H.
* objalloc.c: Include config.h. Include stdlib.h and don't
declare malloc or free if HAVE_STDLIB_H.
* strerror.c, strsignal.c: Include stdlib.h if HAVE_STDLIB_H,
else declare malloc without prototype. Include string.h if
HAVE_STRING_H, else declare memset without prototype. Don't
include stddef.h.
2000-05-23 Mike Stump <mrs@wrs.com> 2000-05-23 Mike Stump <mrs@wrs.com>
* Makefile.in (xmalloc.o): Add dependency for config.h, fixes make * Makefile.in (xmalloc.o): Add dependency for config.h, fixes make
......
...@@ -41,6 +41,10 @@ Boston, MA 02111-1307, USA. */ ...@@ -41,6 +41,10 @@ Boston, MA 02111-1307, USA. */
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include <stdio.h> #include <stdio.h>
#include "libiberty.h" #include "libiberty.h"
......
...@@ -18,6 +18,8 @@ Foundation, 59 Temple Place - Suite 330, ...@@ -18,6 +18,8 @@ Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */ Boston, MA 02111-1307, USA. */
#include "ansidecl.h" #include "ansidecl.h"
#include "config.h"
#include "objalloc.h" #include "objalloc.h"
/* Get a definition for NULL. */ /* Get a definition for NULL. */
...@@ -33,11 +35,16 @@ Boston, MA 02111-1307, USA. */ ...@@ -33,11 +35,16 @@ Boston, MA 02111-1307, USA. */
#include <stddef.h> #include <stddef.h>
#endif #endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#else
/* For systems with larger pointers than ints, this must be declared. */ /* For systems with larger pointers than ints, this must be declared. */
extern PTR malloc PARAMS ((size_t)); extern PTR malloc PARAMS ((size_t));
extern void free PARAMS ((PTR)); extern void free PARAMS ((PTR));
#endif #endif
#endif
/* These routines allocate space for an object. Freeing allocated /* These routines allocate space for an object. Freeing allocated
space may or may not free all more recently allocated space. space may or may not free all more recently allocated space.
......
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "libiberty.h" #include "libiberty.h"
#include "partition.h" #include "partition.h"
......
...@@ -35,6 +35,9 @@ Boston, MA 02111-1307, USA. */ ...@@ -35,6 +35,9 @@ Boston, MA 02111-1307, USA. */
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#define ISSPACE (x) isspace(x) #define ISSPACE (x) isspace(x)
#ifdef HAVE_SYS_WAIT_H #ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h> #include <sys/wait.h>
......
...@@ -28,6 +28,9 @@ Boston, MA 02111-1307, USA. */ ...@@ -28,6 +28,9 @@ Boston, MA 02111-1307, USA. */
#ifdef HAVE_STDLIB_H #ifdef HAVE_STDLIB_H
#include <stdlib.h> #include <stdlib.h>
#endif #endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifndef UCHAR_MAX #ifndef UCHAR_MAX
#define UCHAR_MAX ((unsigned char)(-1)) #define UCHAR_MAX ((unsigned char)(-1))
......
...@@ -25,14 +25,17 @@ ...@@ -25,14 +25,17 @@
/* Routines imported from standard C runtime libraries. */ /* Routines imported from standard C runtime libraries. */
#ifdef __STDC__ #ifdef HAVE_STDLIB_H
#include <stddef.h> #include <stdlib.h>
extern void *malloc (size_t size); /* 4.10.3.3 */ #else
extern void *memset (void *s, int c, size_t n); /* 4.11.6.1 */ extern PTR malloc ();
#else /* !__STDC__ */ #endif
extern char *malloc (); /* Standard memory allocater */
extern char *memset (); #ifdef HAVE_STRING_H
#endif /* __STDC__ */ #include <string.h>
#else
extern PTR memset ();
#endif
#ifndef MAX #ifndef MAX
# define MAX(a,b) ((a) > (b) ? (a) : (b)) # define MAX(a,b) ((a) > (b) ? (a) : (b))
......
...@@ -23,14 +23,17 @@ ...@@ -23,14 +23,17 @@
/* Routines imported from standard C runtime libraries. */ /* Routines imported from standard C runtime libraries. */
#ifdef __STDC__ #ifdef HAVE_STDLIB_H
#include <stddef.h> #include <stdlib.h>
extern void *malloc (size_t size); /* 4.10.3.3 */ #else
extern void *memset (void *s, int c, size_t n); /* 4.11.6.1 */ extern PTR malloc ();
#else /* !__STDC__ */ #endif
extern char *malloc (); /* Standard memory allocater */
extern char *memset (); #ifdef HAVE_STRING_H
#endif /* __STDC__ */ #include <string.h>
#else
extern PTR memset ();
#endif
/* Undefine the macro we used to hide the definition of sys_siglist /* Undefine the macro we used to hide the definition of sys_siglist
found in the system header files. */ found in the system header files. */
......
...@@ -21,6 +21,9 @@ Boston, MA 02111-1307, USA. */ ...@@ -21,6 +21,9 @@ Boston, MA 02111-1307, USA. */
#include "libiberty.h" #include "libiberty.h"
#include <stdio.h> #include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
/* This variable is set by xatexit if it is called. This way, xmalloc /* This variable is set by xatexit if it is called. This way, xmalloc
doesn't drag xatexit into the link. */ doesn't drag xatexit into the link. */
......
...@@ -9,6 +9,9 @@ ...@@ -9,6 +9,9 @@
#include "libiberty.h" #include "libiberty.h"
#include <sys/types.h> /* For size_t. */ #include <sys/types.h> /* For size_t. */
#ifdef HAVE_STRING_H
#include <string.h>
#endif
PTR PTR
xmemdup (input, copy_size, alloc_size) xmemdup (input, copy_size, alloc_size)
......
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