use WS_VSB interface

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