summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaël Bonithon <gael@xfce.org>2023-04-20 16:52:19 +0200
committerGaël Bonithon <gael@xfce.org>2023-04-20 16:52:19 +0200
commitf74589f53041abff29d538a5d9884c3202f2c00a (patch)
tree341a021b2c6a29ccfd4a8d0b5f06afa2d4c3bb71
parent9d2f65576f5e05af07f9b9ae685b91b30807423b (diff)
downloadglib-f74589f53041abff29d538a5d9884c3202f2c00a.tar.gz
gkeyfile: Replace g_slice_*() with g_new*()/g_free_sized()
-rw-r--r--glib/gkeyfile.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c
index 9a4821bc5..d76335653 100644
--- a/glib/gkeyfile.c
+++ b/glib/gkeyfile.c
@@ -638,7 +638,7 @@ G_DEFINE_QUARK (g-key-file-error-quark, g_key_file_error)
static void
g_key_file_init (GKeyFile *key_file)
{
- key_file->current_group = g_slice_new0 (GKeyFileGroup);
+ key_file->current_group = g_new0 (GKeyFileGroup, 1);
key_file->groups = g_list_prepend (NULL, key_file->current_group);
key_file->group_hash = NULL;
key_file->start_group = NULL;
@@ -700,7 +700,7 @@ g_key_file_new (void)
{
GKeyFile *key_file;
- key_file = g_slice_new0 (GKeyFile);
+ key_file = g_new0 (GKeyFile, 1);
key_file->ref_count = 1;
g_key_file_init (key_file);
@@ -1205,7 +1205,7 @@ g_key_file_free (GKeyFile *key_file)
g_key_file_clear (key_file);
if (g_atomic_int_dec_and_test (&key_file->ref_count))
- g_slice_free (GKeyFile, key_file);
+ g_free_sized (key_file, sizeof (GKeyFile));
else
g_key_file_init (key_file);
}
@@ -1227,7 +1227,7 @@ g_key_file_unref (GKeyFile *key_file)
if (g_atomic_int_dec_and_test (&key_file->ref_count))
{
g_key_file_clear (key_file);
- g_slice_free (GKeyFile, key_file);
+ g_free_sized (key_file, sizeof (GKeyFile));
}
}
@@ -1317,7 +1317,7 @@ g_key_file_parse_comment (GKeyFile *key_file,
g_warn_if_fail (key_file->current_group != NULL);
- pair = g_slice_new (GKeyFileKeyValuePair);
+ pair = g_new (GKeyFileKeyValuePair, 1);
pair->key = NULL;
pair->value = g_strndup (line, length);
@@ -1442,7 +1442,7 @@ g_key_file_parse_key_value_pair (GKeyFile *key_file,
{
GKeyFileKeyValuePair *pair;
- pair = g_slice_new (GKeyFileKeyValuePair);
+ pair = g_new (GKeyFileKeyValuePair, 1);
pair->key = g_steal_pointer (&key);
pair->value = g_strndup (value_start, value_len);
@@ -3339,7 +3339,7 @@ g_key_file_set_key_comment (GKeyFile *key_file,
/* Now we can add our new comment
*/
- pair = g_slice_new (GKeyFileKeyValuePair);
+ pair = g_new (GKeyFileKeyValuePair, 1);
pair->key = NULL;
pair->value = g_key_file_parse_comment_as_value (key_file, comment);
@@ -3383,7 +3383,7 @@ g_key_file_set_group_comment (GKeyFile *key_file,
/* Now we can add our new comment
*/
- group->comment = g_slice_new (GKeyFileKeyValuePair);
+ group->comment = g_new (GKeyFileKeyValuePair, 1);
group->comment->key = NULL;
group->comment->value = g_key_file_parse_comment_as_value (key_file, comment);
@@ -3416,7 +3416,7 @@ g_key_file_set_top_comment (GKeyFile *key_file,
if (comment == NULL)
return TRUE;
- pair = g_slice_new (GKeyFileKeyValuePair);
+ pair = g_new (GKeyFileKeyValuePair, 1);
pair->key = NULL;
pair->value = g_key_file_parse_comment_as_value (key_file, comment);
@@ -3840,7 +3840,7 @@ g_key_file_add_group (GKeyFile *key_file,
return;
}
- group = g_slice_new0 (GKeyFileGroup);
+ group = g_new0 (GKeyFileGroup, 1);
group->name = g_strdup (group_name);
group->lookup_map = g_hash_table_new (g_str_hash, g_str_equal);
key_file->groups = g_list_prepend (key_file->groups, group);
@@ -3862,7 +3862,7 @@ g_key_file_key_value_pair_free (GKeyFileKeyValuePair *pair)
{
g_free (pair->key);
g_free (pair->value);
- g_slice_free (GKeyFileKeyValuePair, pair);
+ g_free_sized (pair, sizeof (GKeyFileKeyValuePair));
}
}
@@ -3971,7 +3971,7 @@ g_key_file_remove_group_node (GKeyFile *key_file,
}
g_free ((gchar *) group->name);
- g_slice_free (GKeyFileGroup, group);
+ g_free_sized (group, sizeof (GKeyFileGroup));
g_list_free_1 (group_node);
}
@@ -4031,7 +4031,7 @@ g_key_file_add_key (GKeyFile *key_file,
{
GKeyFileKeyValuePair *pair;
- pair = g_slice_new (GKeyFileKeyValuePair);
+ pair = g_new (GKeyFileKeyValuePair, 1);
pair->key = g_strdup (key);
pair->value = g_strdup (value);