mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-22 17:56:21 +00:00
Cleanup and mem leak fix
Improve usage of `gchar` and `char` by setting them correctly Increase usage of `auto_gchar` and `auto_char` Fix 2 mem leaks (rosterwin.c, avatar.c)
This commit is contained in:
@@ -176,7 +176,7 @@ gchar*
|
||||
files_get_account_data_path(const char* const specific_dir, const char* const jid)
|
||||
{
|
||||
auto_gchar gchar* data_dir = files_get_data_path(specific_dir);
|
||||
auto_gchar gchar* account_dir = str_replace(jid, "@", "_at_");
|
||||
auto_char char* account_dir = str_replace(jid, "@", "_at_");
|
||||
|
||||
return g_strdup_printf("%s/%s", data_dir, account_dir);
|
||||
}
|
||||
|
||||
@@ -541,13 +541,13 @@ prefs_get_string(preference_t pref)
|
||||
}
|
||||
|
||||
gchar*
|
||||
prefs_get_string_with_option(preference_t pref, gchar* option)
|
||||
prefs_get_string_with_locale(preference_t pref, gchar* locale)
|
||||
{
|
||||
const char* group = _get_group(pref);
|
||||
const char* key = _get_key(pref);
|
||||
char* def = _get_default_string(pref);
|
||||
|
||||
gchar* result = g_key_file_get_locale_string(prefs, group, key, option, NULL);
|
||||
gchar* result = g_key_file_get_locale_string(prefs, group, key, locale, NULL);
|
||||
|
||||
if (result == NULL) {
|
||||
// check for user set default
|
||||
@@ -566,14 +566,14 @@ prefs_get_string_with_option(preference_t pref, gchar* option)
|
||||
}
|
||||
|
||||
void
|
||||
prefs_set_string(preference_t pref, char* value)
|
||||
prefs_set_string(preference_t pref, gchar* new_value)
|
||||
{
|
||||
const char* group = _get_group(pref);
|
||||
const char* key = _get_key(pref);
|
||||
if (value == NULL) {
|
||||
if (new_value == NULL) {
|
||||
g_key_file_remove_key(prefs, group, key, NULL);
|
||||
} else {
|
||||
g_key_file_set_string(prefs, group, key, value);
|
||||
g_key_file_set_string(prefs, group, key, new_value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -336,8 +336,8 @@ void prefs_save_win_placement(ProfWinPlacement* placement);
|
||||
gboolean prefs_get_boolean(preference_t pref);
|
||||
void prefs_set_boolean(preference_t pref, gboolean value);
|
||||
gchar* prefs_get_string(preference_t pref);
|
||||
gchar* prefs_get_string_with_option(preference_t pref, gchar* option);
|
||||
void prefs_set_string(preference_t pref, char* value);
|
||||
gchar* prefs_get_string_with_locale(preference_t pref, gchar* locale);
|
||||
void prefs_set_string(preference_t pref, gchar* new_value);
|
||||
void prefs_set_string_with_option(preference_t pref, char* option, char* value);
|
||||
void prefs_set_string_list_with_option(preference_t pref, char* option, const gchar* const* values);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user