Change char->free to auto_char char for autocleanup

Replace `gchar` and `g_free` to `auto_gchar`
Correct certain  `char` functions/variables to `gchar`

Related to #1819.

Edited by @jubalh.
This commit is contained in:
John Hernandez
2023-07-11 13:23:58 +02:00
parent 245d69deb6
commit e1d137f4e6
62 changed files with 498 additions and 969 deletions

View File

@@ -52,9 +52,7 @@ static gchar* account_jid = NULL;
static void
_bookmark_ignore_load()
{
gchar* bi_loc;
bi_loc = files_get_data_path(FILE_BOOKMARK_AUTOJOIN_IGNORE);
auto_gchar gchar* bi_loc = files_get_data_path(FILE_BOOKMARK_AUTOJOIN_IGNORE);
if (g_file_test(bi_loc, G_FILE_TEST_EXISTS)) {
g_chmod(bi_loc, S_IRUSR | S_IWUSR);
@@ -62,24 +60,18 @@ _bookmark_ignore_load()
bookmark_ignore_keyfile = g_key_file_new();
g_key_file_load_from_file(bookmark_ignore_keyfile, bi_loc, G_KEY_FILE_KEEP_COMMENTS, NULL);
g_free(bi_loc);
}
static void
_bookmark_save()
{
gsize g_data_size;
gchar* g_bookmark_ignore_data = g_key_file_to_data(bookmark_ignore_keyfile, &g_data_size, NULL);
auto_gchar gchar* g_bookmark_ignore_data = g_key_file_to_data(bookmark_ignore_keyfile, &g_data_size, NULL);
gchar* bi_loc;
bi_loc = files_get_data_path(FILE_BOOKMARK_AUTOJOIN_IGNORE);
auto_gchar gchar* bi_loc = files_get_data_path(FILE_BOOKMARK_AUTOJOIN_IGNORE);
g_file_set_contents(bi_loc, g_bookmark_ignore_data, g_data_size, NULL);
g_chmod(bi_loc, S_IRUSR | S_IWUSR);
g_free(bi_loc);
g_free(g_bookmark_ignore_data);
}
void