From 977399bb759aacd2a18ba76df78078ee4cee6e67 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 2 Apr 2024 13:44:10 -0400 Subject: Changes to strlist_*() functions: Functions that modify the input StrList have been refactored to use `struct StrList **` instead of `struct StrList *`. * Fixes realloc error handling --- src/environment.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/environment.c') diff --git a/src/environment.c b/src/environment.c index 525e1da..824b447 100644 --- a/src/environment.c +++ b/src/environment.c @@ -149,7 +149,7 @@ RuntimeEnv *runtime_copy(char **env) { rt = strlist_init(); for (size_t i = 0; i < env_count; i++) { - strlist_append(rt, env[i]); + strlist_append(&rt, env[i]); } return rt; } @@ -411,9 +411,9 @@ void runtime_set(RuntimeEnv *env, const char *_key, char *_value) { char *now = join((char *[]) {key, value, NULL}, "="); if (key_offset < 0) { - strlist_append(env, now); + strlist_append(&env, now); } else { - strlist_set(env, key_offset, now); + strlist_set(&env, key_offset, now); } guard_free(now); guard_free(key); @@ -439,5 +439,5 @@ void runtime_free(RuntimeEnv *env) { if (env == NULL) { return; } - strlist_free(env); + strlist_free(&env); } -- cgit