diff options
Diffstat (limited to 'src/format.c')
| -rw-r--r-- | src/format.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/format.c b/src/format.c index 4657359..8f42c00 100644 --- a/src/format.c +++ b/src/format.c @@ -7,13 +7,13 @@ #include "any_log.h" #include "util.h" -#define format_grow() \ +#define format_grow(need) \ do { \ if (n + 1 >= length) { \ - length += 4; \ + length += (need); \ parts = realloc(parts, length * sizeof(char *)); \ assert(parts != NULL); \ - marks = realloc(marks, length * sizeof(bool)); \ + marks = realloc(marks, length * sizeof(uint8_t)); \ assert(marks != NULL); \ } \ } while (0) @@ -31,7 +31,7 @@ bool format_init(format_t *format, const char *string, char delim) // TODO: Escape formatting if (string[end + 1] == '{') { - format_grow(); + format_grow(2); if (start != end) { parts[n] = strslice(string, start, end); @@ -74,7 +74,7 @@ next: if (start != end || string[end] != '\0') { while (string[end] != '\0') end++; - format_grow(); + format_grow(1); parts[n] = strslice(string, start, end); marks[n] = false; n++; |
