* utils.c: Always ensure that size_t is defined. Check

HAVE_STDDEF_H rather than __STDC__
	(xmalloc, xrealloc): Use size_t rather than long.
This commit is contained in:
Ian Lance Taylor 1996-10-15 22:24:17 +00:00
parent 3f3d60c1bc
commit 03e2a8c8a0
2 changed files with 26 additions and 19 deletions

View file

@ -1,3 +1,9 @@
Tue Oct 15 18:19:42 1996 Ian Lance Taylor <ian@cygnus.com>
* utils.c: Always ensure that size_t is defined. Check
HAVE_STDDEF_H rather than __STDC__
(xmalloc, xrealloc): Use size_t rather than long.
Tue Oct 15 14:24:19 1996 Martin M. Hunt <hunt@pizza.cygnus.com> Tue Oct 15 14:24:19 1996 Martin M. Hunt <hunt@pizza.cygnus.com>
* config/powerpc/tm-ppc-eabi.h: Undefine NO_SINGLE_STEP so targets * config/powerpc/tm-ppc-eabi.h: Undefine NO_SINGLE_STEP so targets

View file

@ -1,5 +1,5 @@
/* General utility routines for GDB, the GNU debugger. /* General utility routines for GDB, the GNU debugger.
Copyright 1986, 1989, 1990, 1991, 1992, 1995 Free Software Foundation, Inc. Copyright 1986, 89, 90, 91, 92, 95, 1996 Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -18,11 +18,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "defs.h" #include "defs.h"
#if !defined(__GO32__) && !defined(__WIN32__) && !defined(MPW)
#include <sys/ioctl.h>
#include <sys/param.h>
#include <pwd.h>
#endif
#ifdef ANSI_PROTOTYPES #ifdef ANSI_PROTOTYPES
#include <stdarg.h> #include <stdarg.h>
#else #else
@ -399,8 +394,10 @@ fatal_dump_core (va_alist)
fprintf_unfiltered (gdb_stderr, "\n"); fprintf_unfiltered (gdb_stderr, "\n");
va_end (args); va_end (args);
#ifndef _WIN32
signal (SIGQUIT, SIG_DFL); signal (SIGQUIT, SIG_DFL);
kill (getpid (), SIGQUIT); kill (getpid (), SIGQUIT);
#endif
/* We should never get here, but just in case... */ /* We should never get here, but just in case... */
exit (1); exit (1);
} }
@ -536,7 +533,7 @@ quit ()
} }
#if defined(__GO32__)||defined(WINGDB) #if defined(__GO32__) || defined(_WIN32)
/* In the absence of signals, poll keyboard for a quit. /* In the absence of signals, poll keyboard for a quit.
Called from #define QUIT pollquit() in xm-go32.h. */ Called from #define QUIT pollquit() in xm-go32.h. */
@ -546,6 +543,7 @@ pollquit()
{ {
if (kbhit ()) if (kbhit ())
{ {
#ifndef _WIN32
int k = getkey (); int k = getkey ();
if (k == 1) { if (k == 1) {
quit_flag = 1; quit_flag = 1;
@ -560,16 +558,20 @@ pollquit()
/* We just ignore it */ /* We just ignore it */
fprintf_unfiltered (gdb_stderr, "CTRL-A to quit, CTRL-B to quit harder\n"); fprintf_unfiltered (gdb_stderr, "CTRL-A to quit, CTRL-B to quit harder\n");
} }
#else
abort ();
#endif
} }
} }
#endif #endif
#if defined(__GO32__)||defined(WINGDB) #if defined(__GO32__) || defined(_WIN32)
void notice_quit() void notice_quit()
{ {
if (kbhit ()) if (kbhit ())
{ {
#ifndef _WIN32
int k = getkey (); int k = getkey ();
if (k == 1) { if (k == 1) {
quit_flag = 1; quit_flag = 1;
@ -582,6 +584,9 @@ void notice_quit()
{ {
fprintf_unfiltered (gdb_stderr, "CTRL-A to quit, CTRL-B to quit harder\n"); fprintf_unfiltered (gdb_stderr, "CTRL-A to quit, CTRL-B to quit harder\n");
} }
#else
abort ();
#endif
} }
} }
#else #else
@ -619,19 +624,15 @@ request_quit (signo)
/* Memory management stuff (malloc friends). */ /* Memory management stuff (malloc friends). */
#if defined (NO_MMALLOC)
/* Make a substitute size_t for non-ANSI compilers. */ /* Make a substitute size_t for non-ANSI compilers. */
#ifdef _AIX #ifndef HAVE_STDDEF_H
#include <stddef.h>
#else /* Not AIX */
#ifndef __STDC__
#ifndef size_t #ifndef size_t
#define size_t unsigned int #define size_t unsigned int
#endif #endif
#endif #endif
#endif /* Not AIX */
#if defined (NO_MMALLOC)
PTR PTR
mmalloc (md, size) mmalloc (md, size)
@ -788,7 +789,7 @@ xmrealloc (md, ptr, size)
PTR PTR
xmalloc (size) xmalloc (size)
long size; size_t size;
{ {
return (xmmalloc ((PTR) NULL, size)); return (xmmalloc ((PTR) NULL, size));
} }
@ -798,7 +799,7 @@ xmalloc (size)
PTR PTR
xrealloc (ptr, size) xrealloc (ptr, size)
PTR ptr; PTR ptr;
long size; size_t size;
{ {
return (xmrealloc ((PTR) NULL, ptr, size)); return (xmrealloc ((PTR) NULL, ptr, size));
} }
@ -1876,14 +1877,14 @@ initialize_utils ()
/* These defaults will be used if we are unable to get the correct /* These defaults will be used if we are unable to get the correct
values from termcap. */ values from termcap. */
#if defined(__GO32__) || defined(__WIN32__) #if defined(__GO32__)
lines_per_page = ScreenRows(); lines_per_page = ScreenRows();
chars_per_line = ScreenCols(); chars_per_line = ScreenCols();
#else #else
lines_per_page = 24; lines_per_page = 24;
chars_per_line = 80; chars_per_line = 80;
#ifndef MPW #if !defined MPW && !defined _WIN32
/* No termcap under MPW, although might be cool to do something /* No termcap under MPW, although might be cool to do something
by looking at worksheet or console window sizes. */ by looking at worksheet or console window sizes. */
/* Initialize the screen height and width from termcap. */ /* Initialize the screen height and width from termcap. */