Commit 85b841f9 authored by Nils Goroll's avatar Nils Goroll

simplify

parent 0ba09bfd
......@@ -260,22 +260,20 @@ ws_alloc_digest(VRT_CTX, const size_t digestsz, void **digestp,
const char * const restrict context,
const char * const restrict caller)
{
unsigned char *spc;
struct vrt_blob *b;
uintptr_t snap;
CHECK_OBJ_NOTNULL(ctx->ws, WS_MAGIC);
AN(digestp);
snap = WS_Snapshot(ctx->ws);
if ((b = WS_Alloc(ctx->ws, sizeof *b)) == NULL) {
VERRNOMEM(ctx, "allocating blob in %s.%s()", context, caller);
return (NULL);
}
if ((b->blob = *digestp = WS_Alloc(ctx->ws, digestsz)) == NULL) {
WS_Reset(ctx->ws, snap);
VERRNOMEM(ctx, "allocating hash result in %s.%s()", context,
caller);
spc = WS_Alloc(ctx->ws, PRNDUP(digestsz) + sizeof *b);
if (spc == NULL) {
VERRNOMEM(ctx, "WS_Alloc in %s.%s()", context, caller);
return (NULL);
}
b = (void *)(spc + PRNDUP(digestsz));
b->blob = *digestp = spc;
b->type = BLOB_BLOBDIGEST_DIGEST_TYPE;
b->len = digestsz;
......
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