/src/ntpsec/include/ntp_malloc.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Define malloc and friends. |
3 | | */ |
4 | | #ifndef GUARD_NTP_MALLOC_H |
5 | | #define GUARD_NTP_MALLOC_H |
6 | | |
7 | | #include <stdlib.h> |
8 | | |
9 | | /* |
10 | | * Deal with platform differences declaring alloca() |
11 | | * This comes nearly verbatim from: |
12 | | * |
13 | | * http://www.gnu.org/software/autoconf/manual/autoconf.html#Particular-Functions |
14 | | * |
15 | | * The only modifications were to remove C++ support and guard against |
16 | | * redefining alloca. |
17 | | */ |
18 | | #ifdef HAVE_ALLOCA_H |
19 | | # include <alloca.h> |
20 | | #elif defined __GNUC__ |
21 | | # ifndef alloca |
22 | | # define alloca __builtin_alloca |
23 | | # endif |
24 | | #elif defined _AIX |
25 | | # ifndef alloca |
26 | | # define alloca __alloca |
27 | | # endif |
28 | | #else |
29 | | # include <stddef.h> |
30 | | void * alloca(size_t); |
31 | | #endif |
32 | | |
33 | | #ifdef EREALLOC_IMPL |
34 | | # define EREALLOC_CALLSITE /* preserve __FILE__ and __LINE__ */ |
35 | | #else |
36 | | # define EREALLOC_IMPL(ptr, newsz, filenm, loc) \ |
37 | 0 | realloc(ptr, (newsz)) |
38 | | #endif |
39 | | |
40 | | #include <strings.h> |
41 | | |
42 | 423 | #define ZERO(var) memset(&(var), '\0', sizeof(var)) |
43 | | |
44 | | #endif /* GUARD_NTP_MALLOC_H */ |