diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2015-11-03 16:25:23 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2015-11-03 16:25:23 +0100 |
| commit | 563c515068fc63cdabe9ccec9292714c78fae8eb (patch) | |
| tree | 0603b4f604529ff55109859067f3ff2899d3d963 /buffer.h | |
| parent | 621edbca00ae599e46f7a68ee9f17aa4049496e5 (diff) | |
| download | vis-563c515068fc63cdabe9ccec9292714c78fae8eb.tar.gz vis-563c515068fc63cdabe9ccec9292714c78fae8eb.tar.xz | |
buffer: add buffer_insert to insert data at an arbitrary position
Use it to implement buffer_{pre,ap}pend.
Diffstat (limited to 'buffer.h')
| -rw-r--r-- | buffer.h | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -23,6 +23,10 @@ void buffer_truncate(Buffer*); bool buffer_put(Buffer*, const void *data, size_t len); /* same but with NUL-terminated data */ bool buffer_put0(Buffer*, const char *data); +/* insert arbitrary data of length len at pos (in [0, buf->len]) */ +bool buffer_insert(Buffer*, size_t pos, const void *data, size_t len); +/* insert NUL-terminate data at pos (in [0, buf->len]) */ +bool buffer_insert0(Buffer*, size_t pos, const char *data); /* append futher content to the end of the buffer data */ bool buffer_append(Buffer*, const void *data, size_t len); /* append NUl-terminated data */ |
