aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/gdbserver/utils.c')
-rw-r--r--gdb/gdbserver/utils.c77
1 files changed, 2 insertions, 75 deletions
diff --git a/gdb/gdbserver/utils.c b/gdb/gdbserver/utils.c
index 78ae6f7..f804ced 100644
--- a/gdb/gdbserver/utils.c
+++ b/gdb/gdbserver/utils.c
@@ -35,10 +35,8 @@
/* Generally useful subroutines used throughout the program. */
-static void malloc_failure (size_t size) ATTR_NORETURN;
-
-static void
-malloc_failure (size_t size)
+void
+malloc_failure (long size)
{
fprintf (stderr,
PREFIX "ran out of memory while trying to allocate %lu bytes\n",
@@ -46,61 +44,6 @@ malloc_failure (size_t size)
exit (1);
}
-/* Allocate memory without fail.
- If malloc fails, this will print a message to stderr and exit. */
-
-void *
-xmalloc (size_t size)
-{
- void *newmem;
-
- if (size == 0)
- size = 1;
- newmem = malloc (size);
- if (!newmem)
- malloc_failure (size);
-
- return newmem;
-}
-
-/* Reallocate memory without fail. This works like xmalloc. */
-
-void *
-xrealloc (void *ptr, size_t size)
-{
- void *val;
-
- if (size == 0)
- size = 1;
-
- if (ptr != NULL)
- val = realloc (ptr, size); /* OK: realloc */
- else
- val = malloc (size); /* OK: malloc */
- if (val == NULL)
- malloc_failure (size);
-
- return val;
-}
-
-/* Allocate memory without fail and set it to zero.
- If malloc fails, this will print a message to stderr and exit. */
-
-void *
-xcalloc (size_t nelem, size_t elsize)
-{
- void *newmem;
-
- if (nelem == 0 || elsize == 0)
- nelem = elsize = 1;
-
- newmem = calloc (nelem, elsize);
- if (!newmem)
- malloc_failure (nelem * elsize);
-
- return newmem;
-}
-
/* Copy a string into a memory buffer.
If malloc fails, this will print a message to stderr and exit. */
@@ -239,22 +182,6 @@ get_cell (void)
return buf[cell];
}
-/* Stdarg wrapper around vsnprintf.
- SIZE is the size of the buffer pointed to by STR. */
-
-int
-xsnprintf (char *str, size_t size, const char *format, ...)
-{
- va_list args;
- int ret;
-
- va_start (args, format);
- ret = vsnprintf (str, size, format, args);
- va_end (args);
-
- return ret;
-}
-
static char *
decimal2str (char *sign, ULONGEST addr)
{