VRT_blob() to return vrt_null_blob for empty blobs

parent 48b9d1bf
......@@ -1163,6 +1163,9 @@ VRT_blob(VRT_CTX, const char *err, const void *src, size_t len, unsigned type)
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ctx->ws, WS_MAGIC);
if (src == NULL || len == 0)
return (vrt_null_blob);
p = (void *)WS_Alloc(ctx->ws, sizeof *p);
if (p == NULL) {
VRT_fail(ctx, "Workspace overflow (%s)", err);
......
......@@ -57,6 +57,8 @@
* vrt_null_strands added
* vrt_null_blob added
* VRT_NULL_BLOB_TYPE added as the .type of vrt_null_blob
* VRT_blob() changed to return vrt_null_blob for
* len == 0 or src == NULL arguments
* 13.0 (2021-03-15)
* Move VRT_synth_page() to deprecated status
* Add VRT_synth_strands() and VRT_synth_blob()
......
......@@ -539,10 +539,6 @@ vmod_sub(VRT_CTX, VCL_BLOB b, VCL_BYTES n, VCL_BYTES off)
return (NULL);
}
if (n == 0)
return (vrt_null_blob);
return (VRT_blob(ctx, "blob.sub",
(const char *)b->blob + off, n, b->type));
}
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