~ubuntu-branches/ubuntu/hardy/renameutils/hardy

« back to all changes in this revision

Viewing changes to lib/realloc.c

  • Committer: Bazaar Package Importer
  • Author(s): Francois Marier
  • Date: 2006-07-21 16:39:15 UTC
  • mfrom: (1.1.4 edgy)
  • Revision ID: james.westby@ubuntu.com-20060721163915-k3kqs080hol8uw1n
Tags: 0.8.1-4
* Enable large file support on 32-bit platforms (closes: #377845)
* Bump Standards-Version up to 3.7.2 (no changes)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Work around bug on some systems where realloc (NULL, 0) fails.
2
 
   Copyright (C) 1997, 2003 Free Software Foundation, Inc.
 
1
/* realloc() function that is glibc compatible.
 
2
   Copyright (C) 1997, 2003, 2004 Free Software Foundation, Inc.
3
3
 
4
4
   This program is free software; you can redistribute it and/or modify
5
5
   it under the terms of the GNU General Public License as published by
13
13
 
14
14
   You should have received a copy of the GNU General Public License
15
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
18
/* written by Jim Meyering */
19
19
 
32
32
rpl_realloc (void *p, size_t n)
33
33
{
34
34
  if (n == 0)
35
 
    n = 1;
36
 
  if (p == 0)
 
35
    {
 
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
44
    return malloc (n);
38
45
  return realloc (p, n);
39
46
}