Refactor zipflow request allocation

parent 9a8bc6d7
......@@ -110,6 +110,26 @@ get_zipflow_top(VRT_CTX)
static struct vdp vdp_zipflow;
static struct zipflow_request *
new_zipflow_request(VRT_CTX, struct zipflow_top *zft)
{
struct zipflow_request *zfr;
WS_TASK_ALLOC_OBJ(ctx, zfr, ZIPFLOW_REQUEST_MAGIC);
if (zfr == NULL)
return (NULL);
VSTAILQ_INSERT_TAIL(&zft->head, zfr, list);
zfr->bundle = 1;
zfr->level = default_level;
zfr->name = "unnamed_file";
zfr->mode = 0644;
zfr->atime = ctx->now;
zfr->mtime = ctx->now;
return (zfr);
}
static struct zipflow_request *
get_zipflow_request(VRT_CTX)
{
......@@ -132,18 +152,10 @@ get_zipflow_request(VRT_CTX)
if (zft == NULL)
return (NULL);
WS_TASK_ALLOC_OBJ(ctx, zfr, ZIPFLOW_REQUEST_MAGIC);
zfr = new_zipflow_request(ctx, zft);
if (zfr == NULL)
return (NULL);
VSTAILQ_INSERT_TAIL(&zft->head, zfr, list);
zfr->bundle = 1;
zfr->level = default_level;
zfr->name = "unnamed_file";
zfr->mode = 0644;
zfr->atime = ctx->now;
zfr->mtime = ctx->now;
task_priv->priv = zfr;
return (zfr);
}
......
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