Skip to content

Commit

Permalink
Merge branch 'jk/strbuf-detach-always-non-null'
Browse files Browse the repository at this point in the history
* jk/strbuf-detach-always-non-null:
  strbuf: always return a non-NULL value from strbuf_detach
  • Loading branch information
peff committed Oct 25, 2012
2 parents bbbd057 + 08ad56f commit 2cfceef
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion strbuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ void strbuf_release(struct strbuf *sb)

char *strbuf_detach(struct strbuf *sb, size_t *sz)
{
char *res = sb->alloc ? sb->buf : NULL;
char *res;
strbuf_grow(sb, 0);
res = sb->buf;
if (sz)
*sz = sb->len;
strbuf_init(sb, 0);
Expand Down

0 comments on commit 2cfceef

Please sign in to comment.