use WS_VSB interface

parent 3eb553c1
......@@ -178,30 +178,17 @@ typedef void pesi_filter_list_t(void *, struct vsb *vsb);
static const char *
pesi_filter_on_ws(struct ws *ws, pesi_filter_list_t *func, void *arg)
{
unsigned u;
struct vsb vsb[1];
const char *p;
AN(func);
AN(arg);
u = WS_ReserveAll(ws);
if (u == 0) {
WS_Release(ws, 0);
WS_MarkOverflow(ws);
return (NULL);
}
AN(VSB_new(vsb, ws->f, u, VSB_FIXEDLEN));
WS_VSB_new(vsb, ws);
func(arg, vsb);
if (VSB_finish(vsb)) {
WS_Release(ws, 0);
WS_MarkOverflow(ws);
return (NULL);
}
if (VSB_len(vsb)) {
WS_Release(ws, VSB_len(vsb) + 1);
return (VSB_data(vsb) + 1);
}
WS_Release(ws, 0);
return ("");
p = WS_VSB_finish(vsb, ws, NULL);
if (p == NULL)
p = "";
return (p);
}
static void v_matchproto_(pesi_filter_list_t)
......
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