X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=src%2Fwrbuf.c;h=e57aab7699ea4f563949daeab8aa7f24a106e355;hp=3c631704dfce0e63a736d236a1efc343e5be0099;hb=29644f5396a22ec0d51266011f57741adb2fd171;hpb=0d6f3ee9720647761ff74414a46828c0b9711ac0 diff --git a/src/wrbuf.c b/src/wrbuf.c index 3c63170..e57aab7 100644 --- a/src/wrbuf.c +++ b/src/wrbuf.c @@ -270,6 +270,15 @@ const char *wrbuf_cstr(WRBUF b) return b->buf; } +const char *wrbuf_cstr_null(WRBUF b) +{ + if (!b || b->pos == 0) + return 0; + assert(b->pos < b->size); + b->buf[b->pos] = '\0'; + return b->buf; +} + void wrbuf_cut_right(WRBUF b, size_t no_to_remove) { if (no_to_remove > b->pos)