28 lines
546 B
C
28 lines
546 B
C
#ifndef RESULTS_H
|
|
#define RESULTS_H
|
|
|
|
typedef enum {
|
|
OK,
|
|
ERR_INVALID_STATE,
|
|
ERR_NO_MEM,
|
|
ERR_SIZE,
|
|
ERR_LIQUID,
|
|
} result_t;
|
|
|
|
#ifdef DEBUG_LIQUID
|
|
#include <stdio.h>
|
|
|
|
# define ERR_CHECK_LIQUID(call) \
|
|
do { \
|
|
liquid_error_code result; \
|
|
if((result = (call)) != LIQUID_OK) { \
|
|
fprintf(stderr, "Liquid call failed in %s:%d: %s\n", __FILE__, __LINE__, liquid_error_info(result)); \
|
|
return ERR_LIQUID; \
|
|
} \
|
|
} while(0);
|
|
#else
|
|
# define ERR_CHECK_LIQUID(call) if((call) != LIQUID_OK) { return ERR_LIQUID; }
|
|
#endif
|
|
|
|
#endif // RESULTS_H
|