Commit acbbd80a by Mumit Khan Committed by Jeff Law

configure.in (checkfuncs): Check for sbrk.

        * configure.in (checkfuncs): Check for sbrk.
        * config.in: Rebuilt.
        * configure: Likewise.
        * xmalloc.c: Use HAVE_SBRK instead of the host specific definitions.

From-SVN: r26480
parent d825fa87
Thu Apr 15 23:00:55 1999 Mumit Khan <khan@xraylith.wisc.edu>
* configure.in (checkfuncs): Check for sbrk.
* config.in: Rebuilt.
* configure: Likewise.
* xmalloc.c: Use HAVE_SBRK instead of the host specific definitions.
1999-04-12 Jim Blandy <jimb@zwingli.cygnus.com>
Fix from Marcus Daniels:
......
......@@ -106,6 +106,9 @@
/* Define if you have the memset function. */
#undef HAVE_MEMSET
/* Define if you have the mkstemps function. */
#undef HAVE_MKSTEMPS
/* Define if you have the on_exit function. */
#undef HAVE_ON_EXIT
......@@ -121,6 +124,9 @@
/* Define if you have the rindex function. */
#undef HAVE_RINDEX
/* Define if you have the sbrk function. */
#undef HAVE_SBRK
/* Define if you have the sigsetmask function. */
#undef HAVE_SIGSETMASK
......
......@@ -154,7 +154,7 @@ funcs="$funcs waitpid"
vars="sys_errlist sys_nerr sys_siglist"
checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times"
checkfuncs="getrusage on_exit psignal strerror strsignal sysconf times sbrk"
# These are neither executed nor required, but they help keep
# autoheader happy without adding a bunch of text to acconfig.h.
......@@ -168,6 +168,7 @@ if test "x" = "y"; then
AC_DEFINE(HAVE_SYS_NERR)
AC_DEFINE(HAVE_SYS_SIGLIST)
AC_CHECK_FUNCS(getrusage on_exit psignal strerror strsignal sysconf times)
AC_CHECK_FUNCS(sbrk)
fi
# For each of these functions, if the host does not provide the
......
......@@ -43,22 +43,22 @@ PTR sbrk PARAMS ((ptrdiff_t));
/* The program name if set. */
static const char *name = "";
#if ! defined (_WIN32) || defined (__CYGWIN__) || defined (_UWIN)
#ifdef HAVE_SBRK
/* The initial sbrk, set when the program name is set. Not used for win32
ports other than cygwin32. */
static char *first_break = NULL;
#endif /* ! _WIN32 || __CYGWIN__ || _UWIN */
#endif /* HAVE_SBRK */
void
xmalloc_set_program_name (s)
const char *s;
{
name = s;
#if ! defined (_WIN32) || defined (__CYGWIN__) || defined (_UWIN)
#ifdef HAVE_SBRK
/* Win32 ports other than cygwin32 don't have brk() */
if (first_break == NULL)
first_break = (char *) sbrk (0);
#endif /* ! _WIN32 || __CYGWIN__ || _UWIN */
#endif /* HAVE_SBRK */
}
PTR
......@@ -72,7 +72,7 @@ xmalloc (size)
newmem = malloc (size);
if (!newmem)
{
#if ! defined (_WIN32) || defined (__CYGWIN__) || defined (_UWIN)
#ifdef HAVE_SBRK
extern char **environ;
size_t allocated;
......@@ -84,12 +84,12 @@ xmalloc (size)
"\n%s%sCan not allocate %lu bytes after allocating %lu bytes\n",
name, *name ? ": " : "",
(unsigned long) size, (unsigned long) allocated);
#else
#else /* HAVE_SBRK */
fprintf (stderr,
"\n%s%sCan not allocate %lu bytes\n",
name, *name ? ": " : "",
(unsigned long) size);
#endif /* ! _WIN32 || __CYGWIN__ || _UWIN */
#endif /* HAVE_SBRK */
xexit (1);
}
return (newmem);
......@@ -107,7 +107,7 @@ xcalloc (nelem, elsize)
newmem = calloc (nelem, elsize);
if (!newmem)
{
#if ! defined (_WIN32) || defined (__CYGWIN__) || defined (_UWIN)
#ifdef HAVE_SBRK
extern char **environ;
size_t allocated;
......@@ -119,12 +119,12 @@ xcalloc (nelem, elsize)
"\n%s%sCan not allocate %lu bytes after allocating %lu bytes\n",
name, *name ? ": " : "",
(unsigned long) (nelem * elsize), (unsigned long) allocated);
#else
#else /* HAVE_SBRK */
fprintf (stderr,
"\n%s%sCan not allocate %lu bytes\n",
name, *name ? ": " : "",
(unsigned long) (nelem * elsize));
#endif /* ! _WIN32 || __CYGWIN__ || _UWIN */
#endif /* HAVE_SBRK */
xexit (1);
}
return (newmem);
......@@ -145,7 +145,7 @@ xrealloc (oldmem, size)
newmem = realloc (oldmem, size);
if (!newmem)
{
#if ! defined (_WIN32) || defined (__CYGWIN__) || defined (_UWIN)
#ifdef HAVE_SBRK
extern char **environ;
size_t allocated;
......@@ -157,12 +157,12 @@ xrealloc (oldmem, size)
"\n%s%sCan not reallocate %lu bytes after allocating %lu bytes\n",
name, *name ? ": " : "",
(unsigned long) size, (unsigned long) allocated);
#else /* ! _WIN32 || __CYGWIN__ || _UWIN */
#else /* HAVE_SBRK */
fprintf (stderr,
"\n%s%sCan not reallocate %lu bytes\n",
name, *name ? ": " : "",
(unsigned long) size);
#endif /* ! _WIN32 || __CYGWIN__ || _UWIN */
#endif /* HAVE_SBRK */
xexit (1);
}
return (newmem);
......
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