diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-12-22 09:25:07 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2016-12-22 09:25:07 +0100 |
| commit | a1bb9deaee96433ad57c7eb7df1ea2d8f41a1b09 (patch) | |
| tree | c6b24e6e81de7fb96ddee79f2ef97e1470ffb942 /buffer.c | |
| parent | c240368d5da8208c15e0263034384414d938afb3 (diff) | |
| download | vis-a1bb9deaee96433ad57c7eb7df1ea2d8f41a1b09.tar.gz vis-a1bb9deaee96433ad57c7eb7df1ea2d8f41a1b09.tar.xz | |
buffer: make default buffer size overridable via C pre-processor
Diffstat (limited to 'buffer.c')
| -rw-r--r-- | buffer.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -6,7 +6,9 @@ #include "buffer.h" #include "util.h" -#define BUF_SIZE 1024 +#ifndef BUFFER_SIZE +#define BUFFER_SIZE 1024 +#endif void buffer_init(Buffer *buf) { memset(buf, 0, sizeof *buf); @@ -14,8 +16,8 @@ void buffer_init(Buffer *buf) { bool buffer_grow(Buffer *buf, size_t size) { /* ensure minimal buffer size, to avoid repeated realloc(3) calls */ - if (size < BUF_SIZE) - size = BUF_SIZE; + if (size < BUFFER_SIZE) + size = BUFFER_SIZE; if (buf->size < size) { size = MAX(size, buf->size*2); char *data = realloc(buf->data, size); |
