added mbuf_debug()

This commit is contained in:
Richard Aas 2011-02-07 11:40:51 +00:00
parent ffc3ad8859
commit 6e21cdaf9d
2 changed files with 12 additions and 0 deletions

View file

@ -38,6 +38,7 @@ struct mbuf {
struct pl;
struct re_printf;
struct mbuf *mbuf_alloc(size_t size);
struct mbuf *mbuf_alloc_ref(struct mbuf *mbr);
@ -63,6 +64,7 @@ int mbuf_vprintf(struct mbuf *mb, const char *fmt, va_list ap);
int mbuf_printf(struct mbuf *mb, const char *fmt, ...);
int mbuf_write_pl_skip(struct mbuf *mb, const struct pl *pl,
const struct pl *skip);
int mbuf_debug(struct re_printf *pf, const struct mbuf *mb);
/**

View file

@ -499,3 +499,13 @@ int mbuf_write_pl_skip(struct mbuf *mb, const struct pl *pl,
return mbuf_write_mem(mb, (const uint8_t *)r.p, r.l);
}
int mbuf_debug(struct re_printf *pf, const struct mbuf *mb)
{
if (!mb)
return 0;
return re_hprintf(pf, "buf=%p pos=%zu end=%zu size=%zu",
mb->buf, mb->pos, mb->end, mb->size);
}