stage1: check for null in buf_len and buf_ptr

follow up for f4b8850002
master
Shawn Landden 2019-06-16 13:17:33 -05:00 committed by Andrew Kelley
parent f4b8850002
commit 4d3356435f
1 changed files with 2 additions and 0 deletions

View File

@ -27,11 +27,13 @@ Buf *buf_sprintf(const char *format, ...)
Buf *buf_vprintf(const char *format, va_list ap);
static inline size_t buf_len(Buf *buf) {
assert(buf);
assert(buf->list.length);
return buf->list.length - 1;
}
static inline char *buf_ptr(Buf *buf) {
assert(buf);
assert(buf->list.length);
return buf->list.items;
}