diff options
author | Niels De Graef <nielsdegraef@gmail.com> | 2023-01-16 13:57:36 +0100 |
---|---|---|
committer | Niels De Graef <ndegraef@redhat.com> | 2023-01-16 15:33:25 +0100 |
commit | 2709cd4c985c507f29b73b82adc55b91d4c5eca0 (patch) | |
tree | 00d4b57528f4d18fe70b47bcdb9584757a2c1a6b /gcr | |
parent | f5c46c8e18aa37898e1da25559937ad375b00fc3 (diff) | |
download | gcr-2709cd4c985c507f29b73b82adc55b91d4c5eca0.tar.gz |
Stop using GSlice
GLib is discussing deprecating/removing it upstream [1] since it has
only limited uses. Next to that, it seems to bork stack traces here when
using ASAN (for which you also have to specify `G_SLICE=always-malloc`
too).
In other words, let's just get rid of using `GSLice` and call the
allocation APIs directly.
[1]: https://gitlab.gnome.org/GNOME/glib/-/issues/1079
Diffstat (limited to 'gcr')
-rw-r--r-- | gcr/gcr-certificate-chain.c | 4 | ||||
-rw-r--r-- | gcr/gcr-record.c | 8 | ||||
-rw-r--r-- | gcr/gcr-subject-public-key.c | 4 | ||||
-rw-r--r-- | gcr/gcr-system-prompter.c | 8 |
4 files changed, 12 insertions, 12 deletions
diff --git a/gcr/gcr-certificate-chain.c b/gcr/gcr-certificate-chain.c index c5cb8b8..adf8457 100644 --- a/gcr/gcr-certificate-chain.c +++ b/gcr/gcr-certificate-chain.c @@ -105,13 +105,13 @@ free_chain_private (gpointer data) g_ptr_array_unref (pv->certificates); g_free (pv->purpose); g_free (pv->peer); - g_slice_free (GcrCertificateChainPrivate, pv); + g_free (pv); } static GcrCertificateChainPrivate* new_chain_private (void) { - GcrCertificateChainPrivate *pv = g_slice_new0 (GcrCertificateChainPrivate); + GcrCertificateChainPrivate *pv = g_new0 (GcrCertificateChainPrivate, 1); pv->certificates = g_ptr_array_new_with_free_func (g_object_unref); return pv; } diff --git a/gcr/gcr-record.c b/gcr/gcr-record.c index e928200..66e7757 100644 --- a/gcr/gcr-record.c +++ b/gcr/gcr-record.c @@ -99,7 +99,7 @@ record_flatten (GcrRecord *record) total += strlen (record->columns[i]) + 1; /* Allocate a new GcrRecordData which will hold all that */ - result = g_slice_new0 (GcrRecord); + result = g_new0 (GcrRecord, 1); result->block = block = record_block_new (NULL, total); at = 0; @@ -149,7 +149,7 @@ _gcr_record_new (GQuark schema, GcrRecord *result; guint i; - result = g_slice_new0 (GcrRecord); + result = g_new0 (GcrRecord, 1); result->block = NULL; result->delimiter = delimiter; @@ -177,7 +177,7 @@ take_and_parse_internal (GcrRecordBlock *block, g_assert (block); - result = g_slice_new0 (GcrRecord); + result = g_new0 (GcrRecord, 1); result->block = block; result->delimiter = delimiter; @@ -725,7 +725,7 @@ _gcr_record_free (gpointer record) g_free (block); } - g_slice_free (GcrRecord, record); + g_free (record); } GQuark diff --git a/gcr/gcr-subject-public-key.c b/gcr/gcr-subject-public-key.c index 9ae79f7..0a7ea0d 100644 --- a/gcr/gcr-subject-public-key.c +++ b/gcr/gcr-subject-public-key.c @@ -508,7 +508,7 @@ load_closure_free (gpointer data) LoadClosure *closure = data; g_object_unref (closure->object); gck_builder_clear (&closure->builder); - g_slice_free (LoadClosure, closure); + g_free (closure); } static void @@ -539,7 +539,7 @@ _gcr_subject_public_key_load_async (GckObject *key, task = g_task_new (NULL, cancellable, callback, user_data); g_task_set_source_tag (task, _gcr_subject_public_key_load_async); - closure = g_slice_new0 (LoadClosure); + closure = g_new0 (LoadClosure, 1); closure->object = g_object_ref (key); lookup_attributes (key, &closure->builder); g_task_set_task_data (task, closure, load_closure_free); diff --git a/gcr/gcr-system-prompter.c b/gcr/gcr-system-prompter.c index 0f993ee..036ea45 100644 --- a/gcr/gcr-system-prompter.c +++ b/gcr/gcr-system-prompter.c @@ -156,7 +156,7 @@ on_prompt_close (GcrPrompt *prompt, static Callback * callback_dup (Callback *original) { - Callback *callback = g_slice_new0 (Callback); + Callback *callback = g_new0 (Callback, 1); g_assert (original != NULL); g_assert (original->path != NULL); g_assert (original->name != NULL); @@ -171,7 +171,7 @@ callback_free (gpointer data) Callback *callback = data; g_free ((gchar *)callback->path); g_free ((gchar *)callback->name); - g_slice_free (Callback, callback); + g_free (callback); } static guint @@ -208,7 +208,7 @@ active_prompt_unref (gpointer data) g_hash_table_destroy (active->changed); if (active->exchange) g_object_unref (active->exchange); - g_slice_free (ActivePrompt, active); + g_free (active); } } @@ -226,7 +226,7 @@ active_prompt_create (GcrSystemPrompter *self, { ActivePrompt *active; - active = g_slice_new0 (ActivePrompt); + active = g_new0 (ActivePrompt, 1); active->refs = 1; active->callback = callback_dup (lookup); active->prompter = g_object_ref (self); |