~ubuntu-branches/ubuntu/precise/wget/precise-proposed

« back to all changes in this revision

Viewing changes to lib/realloc.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2011-10-19 00:00:09 UTC
  • mfrom: (2.1.13 sid)
  • Revision ID: james.westby@ubuntu.com-20111019000009-8p33w3wz4b1rdri0
Tags: 1.13-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add wget-udeb to ship wget.gnu as alternative to busybox wget
    implementation.
  - Depend on libssl-dev 0.9.8k-7ubuntu4 (LP: #503339)
* Dropped changes, superseded in Debian:
  - Keep build dependencies in main:
    + debian/control: remove info2man build-dep
    + debian/patches/series: disable wget-infopod_generated_manpage
  - Mark wget Multi-Arch: foreign, so packages that aren't of the same arch
    can depend on it.
* Pass --with-ssl=openssl; we don't want to use gnutls, there's no udeb for
  it.
* Add a second build pass for the udeb, so we can build without libidn.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* realloc() function that is glibc compatible.
2
2
 
3
 
   Copyright (C) 1997, 2003, 2004, 2006, 2007, 2009 Free Software
 
3
   Copyright (C) 1997, 2003-2004, 2006-2007, 2009-2011 Free Software
4
4
   Foundation, Inc.
5
5
 
6
6
   This program is free software: you can redistribute it and/or modify
18
18
 
19
19
/* written by Jim Meyering and Bruno Haible */
20
20
 
 
21
#define _GL_USE_STDLIB_ALLOC 1
21
22
#include <config.h>
22
23
 
23
24
/* Only the AC_FUNC_REALLOC macro defines 'realloc' already in config.h.  */
24
25
#ifdef realloc
25
26
# define NEED_REALLOC_GNU 1
 
27
/* Whereas the gnulib module 'realloc-gnu' defines HAVE_REALLOC_GNU.  */
 
28
#elif GNULIB_REALLOC_GNU && !HAVE_REALLOC_GNU
 
29
# define NEED_REALLOC_GNU 1
26
30
#endif
27
31
 
28
32
/* Infer the properties of the system's malloc function.
29
 
   Only the AC_FUNC_MALLOC macro defines 'malloc' already in config.h.  */
30
 
#if GNULIB_MALLOC_GNU && !defined malloc
 
33
   The gnulib module 'malloc-gnu' defines HAVE_MALLOC_GNU.  */
 
34
#if GNULIB_MALLOC_GNU && HAVE_MALLOC_GNU
31
35
# define SYSTEM_MALLOC_GLIBC_COMPATIBLE 1
32
36
#endif
33
37
 
34
 
/* Below we want to call the system's malloc and realloc.
35
 
   Undefine the symbols here so that including <stdlib.h> provides a
36
 
   declaration of malloc(), not of rpl_malloc(), and likewise for realloc.  */
37
 
#undef malloc
38
 
#undef realloc
39
 
 
40
 
/* Specification.  */
41
38
#include <stdlib.h>
42
39
 
43
40
#include <errno.h>
44
41
 
45
 
/* Below we want to call the system's malloc and realloc.
46
 
   Undefine the symbols, if they were defined by gnulib's <stdlib.h>
47
 
   replacement.  */
48
 
#undef malloc
49
 
#undef realloc
50
 
 
51
42
/* Change the size of an allocated block of memory P to N bytes,
52
43
   with error checking.  If N is zero, change it to 1.  If P is NULL,
53
44
   use malloc.  */
72
63
    {
73
64
#if GNULIB_REALLOC_GNU && !NEED_REALLOC_GNU && !SYSTEM_MALLOC_GLIBC_COMPATIBLE
74
65
      if (n == 0)
75
 
        n = 1;
 
66
        n = 1;
76
67
#endif
77
68
      result = malloc (n);
78
69
    }