| 20 | #include "postgres_fe.h" |
| 21 | |
| 22 | static inline void * |
| 23 | pg_malloc_internal(size_t size, int flags) |
| 24 | { |
| 25 | void *tmp; |
| 26 | |
| 27 | /* Avoid unportable behavior of malloc(0) */ |
| 28 | if (size == 0) |
| 29 | size = 1; |
| 30 | tmp = malloc(size); |
| 31 | if (tmp == NULL) |
| 32 | { |
| 33 | if ((flags & MCXT_ALLOC_NO_OOM) == 0) |
| 34 | { |
| 35 | fprintf(stderr, _("out of memory\n")); |
| 36 | exit(EXIT_FAILURE); |
| 37 | } |
| 38 | return NULL; |
| 39 | } |
| 40 | |
| 41 | if ((flags & MCXT_ALLOC_ZERO) != 0) |
| 42 | MemSet(tmp, 0, size); |
| 43 | return tmp; |
| 44 | } |
| 45 | |
| 46 | void * |
| 47 | pg_malloc(size_t size) |
no outgoing calls
no test coverage detected