Skip to content

Commit

Permalink
Zero byte (twitter#147) (emergency fix needed for pelikan)
Browse files Browse the repository at this point in the history
* buf_write return immediately on 0 byte

* fix bug
  • Loading branch information
thinkingfish authored Apr 1, 2017
1 parent d4002d7 commit 9264bbb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions include/buffer/cc_buf.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ buf_read(char *dst, struct buf *src, uint32_t count)
static inline uint32_t
buf_write(struct buf *dst, char *src, uint32_t count)
{
if (count == 0) {
return 0;
}

ASSERT(dst != NULL && src != NULL);

uint32_t len = MIN(buf_wsize(dst), count);
Expand Down
2 changes: 1 addition & 1 deletion src/cc_print.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ cc_print_int64_unsafe(char *buf, int64_t n)
}

d = digits(ab);
_print_uint64(buf, d, n);
_print_uint64(buf, d, ab);

return d + (n < 0);
}
Expand Down

0 comments on commit 9264bbb

Please sign in to comment.