diff options
Diffstat (limited to '')
| -rw-r--r-- | src/buf.c | 30 |
1 files changed, 15 insertions, 15 deletions
@@ -14,36 +14,36 @@ #include <string.h> struct buf { - uint32_t size; - const void* data; + uint32_t size; + const void* data; }; int buf_create(struct buf** _buf, const void* data, uint32_t size) { - struct buf* buf = malloc(sizeof(struct buf)); - if (!buf) { - log_errno("malloc"); - return -1; - } + struct buf* buf = malloc(sizeof(struct buf)); + if (!buf) { + log_errno("malloc"); + return -1; + } - buf->data = data; - buf->size = size; + buf->data = data; + buf->size = size; - *_buf = buf; - return 0; + *_buf = buf; + return 0; } int buf_create_from_string(struct buf** buf, const char* str) { - return buf_create(buf, str, strlen(str) + 1); + return buf_create(buf, str, strlen(str) + 1); } void buf_destroy(struct buf* buf) { - free(buf); + free(buf); } uint32_t buf_get_size(const struct buf* buf) { - return buf->size; + return buf->size; } const void* buf_get_data(const struct buf* buf) { - return buf->data; + return buf->data; } |
