projects
/
yaz-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bb23356
)
wrbuf_buf: make it always return non-NULL
author
Adam Dickmeiss
<adam@indexdata.dk>
Sat, 19 Apr 2014 09:17:22 +0000
(11:17 +0200)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Sat, 19 Apr 2014 09:22:40 +0000
(11:22 +0200)
Also, wrbuf_buf will return same buffer as previous call to wrbuf_cstr.
src/wrbuf.c
patch
|
blob
|
history
diff --git
a/src/wrbuf.c
b/src/wrbuf.c
index
21401c7
..
69586e0
100644
(file)
--- a/
src/wrbuf.c
+++ b/
src/wrbuf.c
@@
-31,6
+31,7
@@
WRBUF wrbuf_alloc(void)
n->buf = 0;
n->size = 0;
n->pos = 0;
+ wrbuf_grow(n, 1);
return n;
}
@@
-262,9
+263,7
@@
void wrbuf_iconv_reset(WRBUF b, yaz_iconv_t cd)
const char *wrbuf_cstr(WRBUF b)
{
- if (b->pos == 0)
- return "";
- assert(b->pos <= b->size);
+ assert(b && b->pos <= b->size);
b->buf[b->pos] = '\0';
return b->buf;
}