MEM: add REALLOC macro

This commit is contained in:
hasufell 2014-05-25 19:00:10 +02:00
parent fc1ac808a2
commit 853fc668f5
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020

View File

@ -30,6 +30,23 @@
#include <stdlib.h>
/**
* Realloc macro which checks if reallocation
* worked via a temporary pointer.
*/
#define REALLOC(ptr, size) \
{ \
void *tmp_ptr = NULL; \
tmp_ptr = realloc(ptr, size); \
if (tmp_ptr == NULL) { \
fprintf(stderr,"NULL Pointer in %s [%d]",__FILE__,__LINE__); \
abort(); \
} \
ptr = tmp_ptr; \
}
void *ntru_malloc(size_t size);
void *ntru_calloc(size_t nmemb, size_t size);