1*a8fa202aSchristos /* $NetBSD: realloc.c,v 1.1.1.1 2016/01/10 21:36:18 christos Exp $ */
2*a8fa202aSchristos
3*a8fa202aSchristos /* rpl_realloc.c -- a replacement for broken realloc implementations
4*a8fa202aSchristos Copyright (C) 2001 Free Software Foundation, Inc.
5*a8fa202aSchristos
6*a8fa202aSchristos This program is free software; you can redistribute it and/or modify
7*a8fa202aSchristos it under the terms of the GNU General Public License as published by
8*a8fa202aSchristos the Free Software Foundation; either version 2, or (at your option)
9*a8fa202aSchristos any later version.
10*a8fa202aSchristos
11*a8fa202aSchristos This program is distributed in the hope that it will be useful,
12*a8fa202aSchristos but WITHOUT ANY WARRANTY; without even the implied warranty of
13*a8fa202aSchristos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14*a8fa202aSchristos GNU General Public License for more details.
15*a8fa202aSchristos
16*a8fa202aSchristos You should have received a copy of the GNU General Public License
17*a8fa202aSchristos along with this program; if not, write to the Free Software Foundation,
18*a8fa202aSchristos Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19*a8fa202aSchristos
20*a8fa202aSchristos #include <stdlib.h>
21*a8fa202aSchristos
22*a8fa202aSchristos void *
rpl_realloc(void * ptr,size_t size)23*a8fa202aSchristos rpl_realloc(void *ptr, size_t size)
24*a8fa202aSchristos {
25*a8fa202aSchristos if (!ptr)
26*a8fa202aSchristos return malloc(size);
27*a8fa202aSchristos if (!size)
28*a8fa202aSchristos {
29*a8fa202aSchristos if (ptr)
30*a8fa202aSchristos free(ptr);
31*a8fa202aSchristos return malloc(size);
32*a8fa202aSchristos }
33*a8fa202aSchristos return realloc(ptr, size);
34*a8fa202aSchristos }
35