Bring back ERR macros with an additional fail argument

in the next commit, we are going to add the option to not fail
parent 7f4e2abf
......@@ -41,17 +41,39 @@
#include "byte_order.h"
#define FAIL(ctx, msg) \
VRT_fail((ctx), "vmod blobdigest error: " msg)
#define VFAIL(ctx, fmt, ...) \
VRT_fail((ctx), "vmod blobdigest error: " fmt, __VA_ARGS__)
#define VFAILNOMEM(ctx, fmt, ...) \
VFAIL((ctx), fmt ", out of space", __VA_ARGS__)
#define FAILNOMEM(ctx, msg) \
FAIL((ctx), msg ", out of space")
#define ERR(fail, ctx, msg) do { \
if (fail) \
VRT_fail((ctx), "vmod blobdigest error: " msg); \
else \
VSLbs((ctx)->vsl, SLT_Error, TOSTRAND(msg)); \
} while (0)
#define VERR(fail, ctx, fmt, ...) do { \
if (fail) \
VRT_fail((ctx), "vmod blobdigest error: " fmt, \
__VA_ARGS__); \
else \
VSLb((ctx)->vsl, SLT_Error, \
"vmod blobdigest error: " fmt, __VA_ARGS__); \
} while (0)
#define VERRNOMEM(fail, ctx, fmt, ...) \
VERR(fail, (ctx), fmt ", out of space", __VA_ARGS__)
#define ERRNOMEM(fail, ctx, msg) \
ERR(fail, (ctx), msg ", out of space")
#define FAIL(ctx, msg) \
ERR(1, ctx, msg)
#define VFAIL(ctx, fmt, ...) \
VERR(1, ctx, fmt, __VA_ARGS__)
#define VFAILNOMEM(ctx, fmt, ...) \
VERRNOMEM(1, ctx, fmt, __VA_ARGS__)
#define FAILNOMEM(ctx, msg) \
ERRNOMEM(1, ctx, msg)
#define INIT_FINI(ctx) (((ctx)->method & (VCL_MET_INIT | VCL_MET_FINI)) != 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment