Commit ae65ef43 authored by Dridi Boukelmoune's avatar Dridi Boukelmoune

vte: New VTE_dump() utility

parent a367c015
...@@ -47,4 +47,5 @@ int VTE_cat(struct vte *, const char *); ...@@ -47,4 +47,5 @@ int VTE_cat(struct vte *, const char *);
int VTE_printf(struct vte *, const char *, ...) v_printflike_(2, 3); int VTE_printf(struct vte *, const char *, ...) v_printflike_(2, 3);
int VTE_finish(struct vte *); int VTE_finish(struct vte *);
int VTE_format(const struct vte *, VTE_format_f *func, void *priv); int VTE_format(const struct vte *, VTE_format_f *func, void *priv);
int VTE_dump(const struct vte *, VTE_format_f *func, void *priv);
void VTE_destroy(struct vte **); void VTE_destroy(struct vte **);
...@@ -239,6 +239,23 @@ VTE_finish(struct vte *vte) ...@@ -239,6 +239,23 @@ VTE_finish(struct vte *vte)
return (-1); \ return (-1); \
} while (0) } while (0)
int
VTE_dump(const struct vte *vte, VTE_format_f *func, void *priv)
{
const char *p;
CHECK_OBJ_NOTNULL(vte, VTE_MAGIC);
AN(func);
if (vte->o_sep <= 0)
return (-1);
p = VSB_data(vte->vsb);
AN(p);
VTE_FORMAT(func, priv, "%s", p);
return (0);
}
int int
VTE_format(const struct vte *vte, VTE_format_f *func, void *priv) VTE_format(const struct vte *vte, VTE_format_f *func, void *priv)
{ {
......
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