Skip to content

Commit

Permalink
buffer: add buffer_length utility function
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed Apr 3, 2016
1 parent 4ad51b6 commit a841dce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,7 @@ size_t buffer_length0(Buffer *buf) {
len--;
return len;
}

size_t buffer_length(Buffer *buf) {
return buf->len;
}
2 changes: 2 additions & 0 deletions buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,7 @@ bool buffer_prepend(Buffer*, const void *data, size_t len);
bool buffer_prepend0(Buffer*, const char *data);
/* return length of a buffer without trailing NUL byte */
size_t buffer_length0(Buffer*);
/* return length of a buffer including possible NUL byte */
size_t buffer_length(Buffer*);

#endif

0 comments on commit a841dce

Please sign in to comment.