~ubuntu-branches/debian/sid/ntp/sid

« back to all changes in this revision

Viewing changes to include/ntp_malloc.h

  • Committer: Package Import Robot
  • Author(s): Peter Eisentraut
  • Date: 2012-02-27 13:55:56 UTC
  • mfrom: (1.2.12)
  • Revision ID: package-import@ubuntu.com-20120227135556-dkx4mkod5trl5bgt
Tags: 1:4.2.6.p5+dfsg-1
* New upstream release (closes: #644673)
* Updated instructions on generating autotools.patch
* Updated standards version

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
#ifndef NTP_MALLOC_H
5
5
#define NTP_MALLOC_H
6
6
 
7
 
#ifdef HAVE_CONFIG_H
8
 
# include <config.h>
9
 
#endif
10
 
 
11
7
#ifdef HAVE_STDLIB_H
12
8
# include <stdlib.h>
13
9
#else
16
12
# endif
17
13
#endif
18
14
 
 
15
/*
 
16
 * Deal with platform differences declaring alloca()
 
17
 * This comes nearly verbatim from:
 
18
 *
 
19
 * http://www.gnu.org/software/autoconf/manual/autoconf.html#Particular-Functions
 
20
 *
 
21
 * The only modifications were to remove C++ support and guard against
 
22
 * redefining alloca.
 
23
 */
 
24
#ifdef HAVE_ALLOCA_H
 
25
# include <alloca.h>
 
26
#elif defined __GNUC__
 
27
# ifndef alloca
 
28
#  define alloca __builtin_alloca
 
29
# endif
 
30
#elif defined _AIX
 
31
# ifndef alloca
 
32
#  define alloca __alloca
 
33
# endif
 
34
#elif defined _MSC_VER
 
35
# include <malloc.h>
 
36
# ifndef alloca
 
37
#  define alloca _alloca
 
38
# endif
 
39
#else
 
40
# include <stddef.h>
 
41
void * alloca(size_t);
 
42
#endif
 
43
 
 
44
#ifdef EREALLOC_IMPL
 
45
# define EREALLOC_CALLSITE      /* preserve __FILE__ and __LINE__ */
 
46
#else
 
47
# define EREALLOC_IMPL(ptr, newsz, filenm, loc) \
 
48
         realloc(ptr, (newsz))
 
49
#endif
 
50
 
 
51
#ifdef HAVE_STRINGS_H
 
52
# include <strings.h>
 
53
# define zero_mem(p, s)         bzero(p, s)
 
54
#endif
 
55
 
 
56
#ifndef zero_mem
 
57
# define zero_mem(p, s)         memset(p, 0, s)
 
58
#endif
 
59
#define ZERO(var)               zero_mem(&(var), sizeof(var))
 
60
 
19
61
#endif  /* NTP_MALLOC_H */