diff options
Diffstat (limited to 'gnu/usr.bin/texinfo/lib/xmalloc.c')
-rw-r--r-- | gnu/usr.bin/texinfo/lib/xmalloc.c | 41 |
1 files changed, 11 insertions, 30 deletions
diff --git a/gnu/usr.bin/texinfo/lib/xmalloc.c b/gnu/usr.bin/texinfo/lib/xmalloc.c index 156989ed711..b91e4fce633 100644 --- a/gnu/usr.bin/texinfo/lib/xmalloc.c +++ b/gnu/usr.bin/texinfo/lib/xmalloc.c @@ -1,12 +1,6 @@ -/* xmalloc.c -- safe versions of malloc and realloc */ +/* xmalloc.c -- safe versions of malloc and realloc. -/* This file is part of GNU Info, a program for reading online documentation - stored in Info format. - - This file has appeared in prior works by the Free Software Foundation; - thus it carries copyright dates from 1988 through 1993. - - Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 Free Software + Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -26,24 +20,20 @@ Written by Brian Fox (bfox@ai.mit.edu). */ #if !defined (ALREADY_HAVE_XMALLOC) -#include <stdio.h> -#include <sys/types.h> +#include "system.h" -extern void *malloc (), *realloc (); -static void memory_error_and_abort (); - -/* **************************************************************** */ -/* */ -/* Memory Allocation and Deallocation. */ -/* */ -/* **************************************************************** */ +static void +memory_error_and_abort (const char *fname) +{ + fprintf (stderr, "%s: Out of virtual memory!\n", fname); + abort (); +} /* Return a pointer to free()able block of memory large enough to hold BYTES number of bytes. If the memory cannot be allocated, print an error message and abort. */ void * -xmalloc (bytes) - int bytes; +xmalloc (size_t bytes) { void *temp = malloc (bytes); @@ -53,9 +43,7 @@ xmalloc (bytes) } void * -xrealloc (pointer, bytes) - void *pointer; - int bytes; +xrealloc (void *pointer, size_t bytes) { void *temp; @@ -70,11 +58,4 @@ xrealloc (pointer, bytes) return (temp); } -static void -memory_error_and_abort (fname) - char *fname; -{ - fprintf (stderr, "%s: Out of virtual memory!\n", fname); - abort (); -} #endif /* !ALREADY_HAVE_XMALLOC */ |