From 8102619275d2456875915d6c2ba7ddceee6718ff Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Thu, 9 Nov 2017 04:56:22 +0100 Subject: [PATCH] Code cleanup --- src/configure.c | 7 +++---- src/settings.c | 9 ++------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/configure.c b/src/configure.c index 62b357b..5c06954 100644 --- a/src/configure.c +++ b/src/configure.c @@ -401,11 +401,10 @@ static int _configure_load(ConfigurePrefs * prefs, String const * directory, String * path; String const * subdirs = NULL; - if((path = string_new(directory)) == NULL) + if((path = string_new_append(directory, "/", PROJECT_CONF, NULL)) + == NULL) return configure_error(1, "%s", error_get(NULL)); - if(string_append(&path, "/") != 0 - || string_append(&path, PROJECT_CONF) != 0 - || (config = config_new()) == NULL) + if((config = config_new()) == NULL) { string_delete(path); return configure_error(1, "%s", error_get(NULL)); diff --git a/src/settings.c b/src/settings.c index 5105d31..76e2ecc 100644 --- a/src/settings.c +++ b/src/settings.c @@ -111,14 +111,9 @@ static int _settings_do(Configure * configure, String const * directory, } if(configure_is_flag_set(configure, PREFS_n)) return 0; - if((filename = string_new(directory)) == NULL) + if((filename = string_new_append(directory, "/config.", extension, + NULL)) == NULL) return 1; - if(string_append(&filename, "/config.") != 0 - || string_append(&filename, extension) != 0) - { - string_delete(filename); - return 1; - } if((fp = fopen(filename, "w")) == NULL) configure_error(0, "%s: %s", filename, strerror(errno)); string_delete(filename);