static bool slshow(void *arg, const char *s) { struct MBuf *mb = arg; if (mbuf_written(mb) > 0) { if (!mbuf_write_byte(mb, ',')) return false; } if (!s) s = "NULL"; //printf("writing: <%s>\n", s); return mbuf_write(mb, s, strlen(s)); }
/* hook for CBTree */ static size_t mdict_getkey(void *ctx, void *obj, const void **dst_p) { struct MDictElem *el = obj; *dst_p = mbuf_data(&el->key); return mbuf_written(&el->key); }