Add a utility macro to allocate mini-objects on the workspace
isn't this something we would have wanted all along?
This simplifies the common pattern to allocate/initialize a miniobj on the workspace to
WS_TASK_ALLOC_OBJ(ctx, myobj, MYOBJ_MAGIC);
if (myobj == NULL)
return (error);
Not against it.
Any idea how many places in the code it could have been used already ?
Any idea how many places in the code it could have been used already ?
I have pushed a commit changing five places in the tree, but the macro is intended more for use in vmods.
If, however, we changed it (or added a variant not calling VRT_fail()), there were more potential sites like here here here or here
Did you consider a coccinelle patch?
Did you consider a coccinelle patch?
Yes, but I deemed the patterns too different - for the given example https://github.com/varnishcache/varnish-cache/pull/3815/commits/afe8b2ca8fce84043b9467753097d519bbb5817e there are three different ways of error handling.