projects
/
yaz-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Add wrbuf_cstr_null
[yaz-moved-to-github.git]
/
src
/
wrbuf.c
diff --git
a/src/wrbuf.c
b/src/wrbuf.c
index
3c63170
..
e57aab7
100644
(file)
--- 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)