Code cleanup
This commit is contained in:
parent
36c1e62388
commit
8102619275
@ -401,11 +401,10 @@ static int _configure_load(ConfigurePrefs * prefs, String const * directory,
|
|||||||
String * path;
|
String * path;
|
||||||
String const * subdirs = NULL;
|
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));
|
return configure_error(1, "%s", error_get(NULL));
|
||||||
if(string_append(&path, "/") != 0
|
if((config = config_new()) == NULL)
|
||||||
|| string_append(&path, PROJECT_CONF) != 0
|
|
||||||
|| (config = config_new()) == NULL)
|
|
||||||
{
|
{
|
||||||
string_delete(path);
|
string_delete(path);
|
||||||
return configure_error(1, "%s", error_get(NULL));
|
return configure_error(1, "%s", error_get(NULL));
|
||||||
|
@ -111,14 +111,9 @@ static int _settings_do(Configure * configure, String const * directory,
|
|||||||
}
|
}
|
||||||
if(configure_is_flag_set(configure, PREFS_n))
|
if(configure_is_flag_set(configure, PREFS_n))
|
||||||
return 0;
|
return 0;
|
||||||
if((filename = string_new(directory)) == NULL)
|
if((filename = string_new_append(directory, "/config.", extension,
|
||||||
|
NULL)) == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
if(string_append(&filename, "/config.") != 0
|
|
||||||
|| string_append(&filename, extension) != 0)
|
|
||||||
{
|
|
||||||
string_delete(filename);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if((fp = fopen(filename, "w")) == NULL)
|
if((fp = fopen(filename, "w")) == NULL)
|
||||||
configure_error(0, "%s: %s", filename, strerror(errno));
|
configure_error(0, "%s: %s", filename, strerror(errno));
|
||||||
string_delete(filename);
|
string_delete(filename);
|
||||||
|
Loading…
Reference in New Issue
Block a user