diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-05-18 22:05:43 (GMT) |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-05-18 22:05:43 (GMT) |
commit | a8cd7705e7898d77764aa12ddcc2e29de1860138 (patch) | |
tree | 970f609cbecbe515998907fd55a12f814ad2edcd /lib/realloc.c | |
parent | 08394ddb2d62ec8aab9121e45ab9c1a102e85ba4 (diff) | |
download | monitoring-plugins-a8cd7705e7898d77764aa12ddcc2e29de1860138.tar.gz |
Synchronise with coreutils 2.95. Gettext now synced with coreutils,
so no longer development platform requirement
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1394 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'lib/realloc.c')
-rw-r--r-- | lib/realloc.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/realloc.c b/lib/realloc.c index ccbf991..fe94822 100644 --- a/lib/realloc.c +++ b/lib/realloc.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* Work around bug on some systems where realloc (NULL, 0) fails. | 1 | /* realloc() function that is glibc compatible. |
2 | Copyright (C) 1997, 2003 Free Software Foundation, Inc. | 2 | Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or modify | 4 | This program is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
@@ -13,11 +13,11 @@ | |||
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License |
15 | along with this program; if not, write to the Free Software Foundation, | 15 | along with this program; if not, write to the Free Software Foundation, |
16 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | 16 | Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ |
17 | 17 | ||
18 | /* written by Jim Meyering */ | 18 | /* written by Jim Meyering */ |
19 | 19 | ||
20 | #if HAVE_CONFIG_H | 20 | #ifdef HAVE_CONFIG_H |
21 | # include <config.h> | 21 | # include <config.h> |
22 | #endif | 22 | #endif |
23 | #undef realloc | 23 | #undef realloc |
@@ -32,8 +32,15 @@ void * | |||
32 | rpl_realloc (void *p, size_t n) | 32 | rpl_realloc (void *p, size_t n) |
33 | { | 33 | { |
34 | if (n == 0) | 34 | if (n == 0) |
35 | n = 1; | 35 | { |
36 | if (p == 0) | 36 | n = 1; |
37 | |||
38 | /* In theory realloc might fail, so don't rely on it to free. */ | ||
39 | free (p); | ||
40 | p = NULL; | ||
41 | } | ||
42 | |||
43 | if (p == NULL) | ||
37 | return malloc (n); | 44 | return malloc (n); |
38 | return realloc (p, n); | 45 | return realloc (p, n); |
39 | } | 46 | } |