From 38637de243c569c0d6aaff455752e617c30c5866 Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Mon, 18 Nov 2024 23:19:32 +0100 Subject: Fix format and add it to ram --- src/format.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/format.c') diff --git a/src/format.c b/src/format.c index 47426ec..4657359 100644 --- a/src/format.c +++ b/src/format.c @@ -31,8 +31,9 @@ bool format_init(format_t *format, const char *string, char delim) // TODO: Escape formatting if (string[end + 1] == '{') { + format_grow(); + if (start != end) { - format_grow(); parts[n] = strslice(string, start, end); marks[n] = false; n++; @@ -70,7 +71,7 @@ bool format_init(format_t *format, const char *string, char delim) next: } - if (string[end] != '\0') { + if (start != end || string[end] != '\0') { while (string[end] != '\0') end++; format_grow(); @@ -108,7 +109,7 @@ bool format_remark(format_t *format, const char *label, const format_pair_t *pai errors++; if (label != NULL) - log_error("Unknown format option '%s' for %s", format->parts[i], label); + log_error("Unknown format option '%s' for block '%s'", format->parts[i], label); next: } -- cgit v1.2.3