Skip to content
Snippets Groups Projects
Commit 07e3c76b authored by Lubos Slovak's avatar Lubos Slovak
Browse files

Some useful macros for checking allocation.

parent 029d5ca6
No related branches found
No related tags found
No related merge requests found
......@@ -43,6 +43,21 @@ typedef unsigned int uint;
#define ERR_ALLOC_FAILED log_error("Allocation failed at %s:%d (%s ver.%x)\n", \
__FILE__, __LINE__, PROJECT_NAME, PROJECT_VER)
#define CHECK_ALLOC_LOG(var) \
do { \
if ((var) == NULL) { \
ERR_ALLOC_FAILED; \
return NULL; \
} \
} while (0)
#define CHECK_ALLOC(var) \
do { \
if ((var) == NULL) { \
return NULL; \
} \
} while (0)
/* Eliminate compiler warning with unused parameters. */
#define UNUSED(param) (param) = (param)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment