diff options
author | Steffen Jaeckel <jaeckel-floss@eyet-services.de> | 2022-03-13 12:18:03 +0100 |
---|---|---|
committer | Steffen Jaeckel <jaeckel-floss@eyet-services.de> | 2022-03-14 13:17:46 +0100 |
commit | 4d7184883701a4bc7481e088bbb883631e723317 (patch) | |
tree | f68228d2a31fed6bccf7c59d25f1a92addbdd27b /src | |
parent | 43e5f15e66b83ac8f3d57d2ffc7babf57873c51c (diff) | |
download | profani-tty-4d7184883701a4bc7481e088bbb883631e723317.tar.gz |
replace `GString` usage where a simple `strdup` works
Signed-off-by: Steffen Jaeckel <jaeckel-floss@eyet-services.de>
Diffstat (limited to 'src')
-rw-r--r-- | src/config/files.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/src/config/files.c b/src/config/files.c index 0f073b8b..7e24dee9 100644 --- a/src/config/files.c +++ b/src/config/files.c @@ -151,13 +151,8 @@ gchar* files_get_config_path(const char* const config_base) { gchar* xdg_config = _files_get_xdg_config_home(); - GString* file_str = g_string_new(xdg_config); - g_string_append(file_str, "/profanity/"); - g_string_append(file_str, config_base); - gchar* result = g_strdup(file_str->str); + gchar* result = g_strdup_printf("%s/profanity/%s", xdg_config, config_base); g_free(xdg_config); - g_string_free(file_str, TRUE); - return result; } @@ -165,13 +160,8 @@ gchar* files_get_data_path(const char* const data_base) { gchar* xdg_data = _files_get_xdg_data_home(); - GString* file_str = g_string_new(xdg_data); - g_string_append(file_str, "/profanity/"); - g_string_append(file_str, data_base); - gchar* result = g_strdup(file_str->str); + gchar* result = g_strdup_printf("%s/profanity/%s", xdg_data, data_base); g_free(xdg_data); - g_string_free(file_str, TRUE); - return result; } @@ -179,16 +169,12 @@ gchar* files_get_account_data_path(const char* const specific_dir, const char* const jid) { gchar* data_dir = files_get_data_path(specific_dir); - GString* result_dir = g_string_new(data_dir); - g_free(data_dir); - gchar* account_dir = str_replace(jid, "@", "_at_"); - g_string_append(result_dir, "/"); - g_string_append(result_dir, account_dir); - g_free(account_dir); - gchar* result = g_strdup(result_dir->str); - g_string_free(result_dir, TRUE); + gchar* result = g_strdup_printf("%s/%s", data_dir, account_dir); + + g_free(account_dir); + g_free(data_dir); return result; } |