Skip to content

Commit

Permalink
buffer: add buffer_content utility function
Browse files Browse the repository at this point in the history
  • Loading branch information
martanne committed Apr 3, 2016
1 parent a841dce commit 09dc605
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 @@ -99,3 +99,7 @@ size_t buffer_length0(Buffer *buf) {
size_t buffer_length(Buffer *buf) {
return buf->len;
}

const char *buffer_content(Buffer *buf) {
return buf->data;
}
2 changes: 2 additions & 0 deletions buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@ bool buffer_prepend0(Buffer*, const char *data);
size_t buffer_length0(Buffer*);
/* return length of a buffer including possible NUL byte */
size_t buffer_length(Buffer*);
/* pointer to buffer data, might be NULL if empty, might not be NUL terminated */
const char *buffer_content(Buffer*);

#endif

0 comments on commit 09dc605

Please sign in to comment.