xref: /netbsd-src/external/gpl2/diffutils/dist/lib/malloc.c (revision f31867506b3d03104824848de4007d9c967e81b2)
1 /*	$NetBSD: malloc.c,v 1.1.1.1 2016/01/13 03:15:30 christos Exp $	*/
2 
3 /* Work around bug on some systems where malloc (0) fails.
4    Copyright (C) 1997, 1998 Free Software Foundation, Inc.
5 
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2, or (at your option)
9    any later version.
10 
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15 
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software Foundation,
18    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
19 
20 /* written by Jim Meyering */
21 
22 #if HAVE_CONFIG_H
23 # include <config.h>
24 #endif
25 #undef malloc
26 
27 #include <sys/types.h>
28 
29 char *malloc ();
30 
31 /* Allocate an N-byte block of memory from the heap.
32    If N is zero, allocate a 1-byte block.  */
33 
34 char *
35 rpl_malloc (size_t n)
36 {
37   if (n == 0)
38     n = 1;
39   return malloc (n);
40 }
41