From 3c36d85db7c689cc20f480492d6ee4f43d27cbf8 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 22 Mar 2024 18:23:48 -0400 Subject: Consolidate pointer assignment to if-statement * Easier to see what's happening. Nothing more. --- src/template.c | 2 +- src/utils.c | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/template.c b/src/template.c index 7a5b0b9..41962c8 100644 --- a/src/template.c +++ b/src/template.c @@ -44,7 +44,7 @@ void tpl_free() { struct tpl_item *item = tpl_pool[i]; if (item) { if (item->key) { - free(item->key); + SYSERROR("freeing template item key: %s", item->key); guard_free(item->key); } free(item); diff --git a/src/utils.c b/src/utils.c index dd3dbe9..51c11e8 100644 --- a/src/utils.c +++ b/src/utils.c @@ -521,8 +521,7 @@ int path_store(char **destptr, size_t maxlen, const char *base, const char *path guard_free(*destptr); } - (*destptr) = realpath(path_tmp, NULL); - if (!*destptr) { + if (!(*destptr = realpath(path_tmp, NULL))) { goto l_path_setup_error; } @@ -638,9 +637,7 @@ int fix_tox_conf(const char *filename, char **result) { } } - if (ini_write(toxini, &fptemp)) { - guard_free(tempfile); - } + ini_write(toxini, &fptemp); fclose(fptemp); *result = tempfile; -- cgit