Use WS_TASK_ALLOC_OBJ()

parent 92566707
...@@ -783,15 +783,15 @@ get_task(VRT_CTX, struct VPFX(pipe_vdp) *obj, const char *method) ...@@ -783,15 +783,15 @@ get_task(VRT_CTX, struct VPFX(pipe_vdp) *obj, const char *method)
priv = VRT_priv_task(ctx, obj); priv = VRT_priv_task(ctx, obj);
AN(priv); AN(priv);
if (priv->priv == NULL) { if (priv->priv == NULL) {
if ((priv->priv = WS_Alloc(ctx->ws, sizeof(*task))) == NULL) { WS_TASK_ALLOC_OBJ(ctx, task, PIPE_TASK_MAGIC);
if (task == NULL) {
VDPFAIL(ctx, "%s.%s(): insufficient workspace for " VDPFAIL(ctx, "%s.%s(): insufficient workspace for "
"task config", obj->name, method); "task config", obj->name, method);
return (NULL); return (NULL);
} }
priv->len = sizeof(*task); priv->len = sizeof(*task);
priv->methods = priv_task_methods; priv->methods = priv_task_methods;
task = (struct task_cfg *)priv->priv; priv->priv = task;
INIT_OBJ(task, PIPE_TASK_MAGIC);
} }
else { else {
AN(WS_Allocated(ctx->ws, priv->priv, sizeof(*task))); AN(WS_Allocated(ctx->ws, priv->priv, sizeof(*task)));
...@@ -952,12 +952,12 @@ vmod_vdp_setenv(VRT_CTX, struct VPFX(pipe_vdp) *obj, VCL_STRING var, ...@@ -952,12 +952,12 @@ vmod_vdp_setenv(VRT_CTX, struct VPFX(pipe_vdp) *obj, VCL_STRING var,
VSTAILQ_INIT(task->setenv_head); VSTAILQ_INIT(task->setenv_head);
} }
if ((entry = WS_Alloc(ctx->ws, sizeof(*entry))) == NULL) { WS_TASK_ALLOC_OBJ(ctx, entry, PIPE_SETENV_MAGIC);
if (entry == NULL) {
VDPFAIL(ctx, "%s.setenv(): insufficient workspace for list " VDPFAIL(ctx, "%s.setenv(): insufficient workspace for list "
"entry", obj->name); "entry", obj->name);
return; return;
} }
INIT_OBJ(entry, PIPE_SETENV_MAGIC);
if ((entry->var = WS_Copy(ctx->ws, var, -1)) == NULL) { if ((entry->var = WS_Copy(ctx->ws, var, -1)) == NULL) {
VDPFAIL(ctx, "%s.setenv(): insufficient workspace for var", VDPFAIL(ctx, "%s.setenv(): insufficient workspace for var",
obj->name); obj->name);
......
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