Rename ERR macros -> FAIL

parent 0f4d0d8a
......@@ -41,17 +41,17 @@
#include "byte_order.h"
#define ERR(ctx, msg) \
#define FAIL(ctx, msg) \
VRT_fail((ctx), "vmod blobdigest error: " msg)
#define VERR(ctx, fmt, ...) \
#define VFAIL(ctx, fmt, ...) \
VRT_fail((ctx), "vmod blobdigest error: " fmt, __VA_ARGS__)
#define VERRNOMEM(ctx, fmt, ...) \
VERR((ctx), fmt ", out of space", __VA_ARGS__)
#define VFAILNOMEM(ctx, fmt, ...) \
VFAIL((ctx), fmt ", out of space", __VA_ARGS__)
#define ERRNOMEM(ctx, msg) \
ERR((ctx), msg ", out of space")
#define FAILNOMEM(ctx, msg) \
FAIL((ctx), msg ", out of space")
#define INIT_FINI(ctx) (((ctx)->method & (VCL_MET_INIT | VCL_MET_FINI)) != 0)
......@@ -268,7 +268,7 @@ ws_alloc_digest(VRT_CTX, const size_t digestsz, void **digestp,
spc = WS_Alloc(ctx->ws, PRNDUP(digestsz) + sizeof *b);
if (spc == NULL) {
VERRNOMEM(ctx, "WS_Alloc in %s.%s()", context, caller);
VFAILNOMEM(ctx, "WS_Alloc in %s.%s()", context, caller);
return (NULL);
}
......@@ -292,7 +292,7 @@ heap_alloc_digest(VRT_CTX, const size_t digestsz, void **digestp,
spc = malloc(PRNDUP(digestsz) + sizeof *b);
if (spc == NULL) {
VERRNOMEM(ctx, "malloc in %s.%s()", context, caller);
VFAILNOMEM(ctx, "malloc in %s.%s()", context, caller);
return (NULL);
}
......@@ -329,7 +329,7 @@ get_scope(const struct vrt_ctx * const restrict ctx,
break;
case TOP: {
if (ctx->req == NULL) {
VERR(ctx, "%s.%s(): object has TOP scope - only "
VFAIL(ctx, "%s.%s(): object has TOP scope - only "
"accessible in client VCL context",
h->vcl_name, method);
return (NULL);
......@@ -347,7 +347,7 @@ get_scope(const struct vrt_ctx * const restrict ctx,
}
if (priv == NULL) {
ERR(ctx, "no priv - out of workspace?");
FAIL(ctx, "no priv - out of workspace?");
return (NULL);
}
......@@ -361,7 +361,7 @@ get_scope(const struct vrt_ctx * const restrict ctx,
else {
task = WS_Alloc(ws, sizeof(struct digest_task));
if (task == NULL) {
VERRNOMEM(ctx, "allocating task data in %s.%s()",
VFAILNOMEM(ctx, "allocating task data in %s.%s()",
h->vcl_name, method);
return (NULL);
}
......@@ -431,7 +431,7 @@ vmod_digest_update(VRT_CTX, struct vmod_blobdigest_digest *h, VCL_BLOB b)
CHECK_OBJ_NOTNULL(h, VMOD_BLOBDIGEST_DIGEST_MAGIC);
if (h->result != NULL) {
VERR(ctx, "already finalized in %s.update()", h->vcl_name);
VFAIL(ctx, "already finalized in %s.update()", h->vcl_name);
return (0);
}
......@@ -440,14 +440,14 @@ vmod_digest_update(VRT_CTX, struct vmod_blobdigest_digest *h, VCL_BLOB b)
return (0);
if (b == NULL) {
VERR(ctx, "null BLOB passed to %s.update()", h->vcl_name);
VFAIL(ctx, "null BLOB passed to %s.update()", h->vcl_name);
return (0);
}
hctx = INIT_FINI(ctx) ? &h->ctx : &task->ctx;
if (task->result != NULL) {
VERR(ctx, "already finalized in %s.update()", h->vcl_name);
VFAIL(ctx, "already finalized in %s.update()", h->vcl_name);
return (0);
}
if (b->len > 0 && b->blob != NULL)
......@@ -563,7 +563,7 @@ vmod_hmac__init(VRT_CTX, struct vmod_blobdigest_hmac **hmacp,
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
AN(vcl_name);
if (key == NULL || key->blob == NULL) {
VERR(ctx, "key is NULL in %s constructor", vcl_name);
VFAIL(ctx, "key is NULL in %s constructor", vcl_name);
return;
}
AN(hmacp);
......@@ -585,7 +585,7 @@ vmod_hmac_hmac(VRT_CTX, struct vmod_blobdigest_hmac *h, VCL_BLOB msg)
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(h, VMOD_BLOBDIGEST_HMAC_MAGIC);
if (msg == NULL || msg->blob == NULL) {
VERR(ctx, "msg is NULL in %s.hmac()", h->vcl_name);
VFAIL(ctx, "msg is NULL in %s.hmac()", h->vcl_name);
return (NULL);
}
......@@ -604,7 +604,7 @@ vmod_hmac_hmac_bench(VRT_CTX, struct vmod_blobdigest_hmac *h, VCL_INT n,
uintptr_t snap;
if (n <= 0) {
ERR(ctx, "number of rounds must be greater than zero");
FAIL(ctx, "number of rounds must be greater than zero");
return (-1);
}
snap = WS_Snapshot(ctx->ws);
......@@ -665,11 +665,11 @@ vmod_hmacf(VRT_CTX, VCL_ENUM hashs, VCL_BLOB key, VCL_BLOB msg)
hash_ctx inner_ctx, outer_ctx;
if (key == NULL || key->blob == NULL) {
ERR(ctx, "key is NULL in blobdigest.hmacf()");
FAIL(ctx, "key is NULL in blobdigest.hmacf()");
return (NULL);
}
if (msg == NULL || msg->blob == NULL) {
ERR(ctx, "msg is NULL in blobdigest.hmacf()");
FAIL(ctx, "msg is NULL in blobdigest.hmacf()");
return (NULL);
}
hmac_init(hash, key, &inner_ctx, &outer_ctx);
......
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