]> git.ipfire.org Git - thirdparty/lldpd.git/blob - src/realloc.c
Add support to read /etc/os-release for system information.
[thirdparty/lldpd.git] / src / realloc.c
1 /* realloc replacement that can reallocate 0 byte or NULL pointers*/
2
3 #undef realloc
4 #include <stdlib.h>
5 #include <sys/types.h>
6
7 /* Reallocate an N-byte block of memory from the heap.
8 If N is zero, allocate a 1-byte block. */
9 void *
10 rpl_realloc(void *ptr, size_t n)
11 {
12 if (!ptr) return malloc(n);
13 if (n == 0) n = 1;
14 return realloc(ptr, n);
15 }