From f8421e9ffe09286c9e9b143d83c6849f187e321d Mon Sep 17 00:00:00 2001 From: hellerve Date: Wed, 18 Mar 2020 23:15:34 +0100 Subject: [PATCH] imminent --- cfg.h | 2 +- examples/nested_simple.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cfg.h b/cfg.h index 78c3b47..da0fb18 100644 --- a/cfg.h +++ b/cfg.h @@ -66,7 +66,7 @@ string string_from_cstr(char* c) { } void string_grow_min(string* s, size_t min_growth) { - s->cap = max(min_growth, s->cap*GROWTH_FACTOR); + s->cap = max(s->cap+min_growth, s->cap*GROWTH_FACTOR); s->str = realloc(s->str, s->cap); } diff --git a/examples/nested_simple.c b/examples/nested_simple.c index 5d3c3e1..f0a586e 100644 --- a/examples/nested_simple.c +++ b/examples/nested_simple.c @@ -7,9 +7,9 @@ int main() { config_add_string(&c, string_from_cstr("mystring"), string_from_cstr("cfg is pretty awesome")); list_config_value l = new_list_config_value(); for (int i = 0; i < 10; i += 2) { - config_value v = config_number(i); - list_push_config_value(&l, v); + list_push_config_value(&l, config_number(i)); } + list_push_config_value(&l, config_string(string_from_cstr("value"))); config_add_list(&c, string_from_cstr("mylist"), &l); config sub = new_config(); config_add_number(&sub, string_from_cstr("mysecondnum"), 23);