From 18a3c32323d541fbd918d7bf27d3a65940d7602b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 24 Jan 2023 20:22:28 +0000 Subject: [PATCH] ges: drop use of GSlice allocator Part-of: --- subprojects/gst-editing-services/ges/ges-asset.c | 4 ++-- .../ges/ges-base-xml-formatter.c | 12 ++++++------ subprojects/gst-editing-services/ges/ges-container.c | 6 +++--- subprojects/gst-editing-services/ges/ges-layer.c | 6 +++--- .../gst-editing-services/ges/ges-meta-container.c | 8 ++++---- subprojects/gst-editing-services/ges/ges-project.c | 4 ++-- .../gst-editing-services/ges/ges-smart-adder.c | 6 +++--- .../gst-editing-services/ges/ges-timeline-element.c | 8 ++++---- subprojects/gst-editing-services/ges/ges-track.c | 4 ++-- .../gst-editing-services/ges/ges-xml-formatter.c | 2 +- .../tests/check/ges/test-utils.c | 6 +++--- 11 files changed, 33 insertions(+), 33 deletions(-) diff --git a/subprojects/gst-editing-services/ges/ges-asset.c b/subprojects/gst-editing-services/ges/ges-asset.c index 503c5d2566..cae5871473 100644 --- a/subprojects/gst-editing-services/ges/ges-asset.c +++ b/subprojects/gst-editing-services/ges/ges-asset.c @@ -610,7 +610,7 @@ _free_entries (gpointer entry) GESAssetCacheEntry *data = (GESAssetCacheEntry *) entry; if (data->asset) gst_object_unref (data->asset); - g_slice_free (GESAssetCacheEntry, entry); + g_free (entry); } static void @@ -740,7 +740,7 @@ ges_asset_cache_put (GESAsset * asset, GTask * task) g_strdup (_extractable_type_name (extractable_type)), entries_table); } - entry = g_slice_new0 (GESAssetCacheEntry); + entry = g_new0 (GESAssetCacheEntry, 1); /* transfer asset to entry */ entry->asset = asset; diff --git a/subprojects/gst-editing-services/ges/ges-base-xml-formatter.c b/subprojects/gst-editing-services/ges/ges-base-xml-formatter.c index 1a1f4e3dbb..6120e30ee6 100644 --- a/subprojects/gst-editing-services/ges/ges-base-xml-formatter.c +++ b/subprojects/gst-editing-services/ges/ges-base-xml-formatter.c @@ -124,7 +124,7 @@ static void _free_layer_entry (LayerEntry * entry) { gst_object_unref (entry->layer); - g_slice_free (LayerEntry, entry); + g_free (entry); } static void @@ -133,7 +133,7 @@ _free_pending_group (PendingGroup * pgroup) if (pgroup->group) g_object_unref (pgroup->group); g_list_free_full (pgroup->pending_children, g_free); - g_slice_free (PendingGroup, pgroup); + g_free (pgroup); } G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GESBaseXmlFormatter, @@ -663,7 +663,7 @@ _free_pending_asset (GESBaseXmlFormatterPrivate * priv, PendingAsset * passet) gst_structure_free (passet->properties); priv->pending_assets = g_list_remove (priv->pending_assets, passet); - g_slice_free (PendingAsset, passet); + g_free (passet); } static void @@ -842,7 +842,7 @@ ges_base_xml_formatter_add_asset (GESBaseXmlFormatter * self, return; } - passet = g_slice_new0 (PendingAsset); + passet = g_new0 (PendingAsset, 1); passet->metadatas = g_strdup (metadatas); passet->id = g_strdup (id); passet->extractable_type = extractable_type; @@ -1005,7 +1005,7 @@ ges_base_xml_formatter_add_layer (GESBaseXmlFormatter * self, g_list_free (tracks); } - entry = g_slice_new0 (LayerEntry); + entry = g_new0 (LayerEntry, 1); entry->layer = gst_object_ref (layer); entry->auto_trans = auto_transition; @@ -1292,7 +1292,7 @@ ges_base_xml_formatter_add_group (GESBaseXmlFormatter * self, return; } - pgroup = g_slice_new0 (PendingGroup); + pgroup = g_new0 (PendingGroup, 1); pgroup->group = ges_group_new (); if (metadatas) diff --git a/subprojects/gst-editing-services/ges/ges-container.c b/subprojects/gst-editing-services/ges/ges-container.c index 75ef8c42f0..f0177a4ddb 100644 --- a/subprojects/gst-editing-services/ges/ges-container.c +++ b/subprojects/gst-editing-services/ges/ges-container.c @@ -127,7 +127,7 @@ _free_mapping (ChildMapping * mapping) gst_object_unref (child); } - g_slice_free (ChildMapping, mapping); + g_free (mapping); } static gint @@ -347,7 +347,7 @@ _deep_copy (GESTimelineElement * element, GESTimelineElement * copy) for (tmp = GES_CONTAINER_CHILDREN (element); tmp; tmp = tmp->next) { ChildMapping *map, *orig_map; orig_map = g_hash_table_lookup (self->priv->mappings, tmp->data); - map = g_slice_new0 (ChildMapping); + map = g_new0 (ChildMapping, 1); map->child = ges_timeline_element_copy (tmp->data, TRUE); map->start_offset = orig_map->start_offset; @@ -758,7 +758,7 @@ ges_container_add (GESContainer * container, GESTimelineElement * child) } } - mapping = g_slice_new0 (ChildMapping); + mapping = g_new0 (ChildMapping, 1); mapping->child = gst_object_ref (child); g_hash_table_insert (priv->mappings, child, mapping); container->children = g_list_append (container->children, child); diff --git a/subprojects/gst-editing-services/ges/ges-layer.c b/subprojects/gst-editing-services/ges/ges-layer.c index 401bba3847..bb09ad22b5 100644 --- a/subprojects/gst-editing-services/ges/ges-layer.c +++ b/subprojects/gst-editing-services/ges/ges-layer.c @@ -434,7 +434,7 @@ new_asset_cb (GESAsset * source, GAsyncResult * res, NewAssetUData * udata) gst_object_unref (asset); gst_object_unref (udata->clip); - g_slice_free (NewAssetUData, udata); + g_free (udata); } /** @@ -714,7 +714,7 @@ ges_layer_add_clip_full (GESLayer * layer, GESClip * clip, GError ** error) asset = ges_extractable_get_asset (GES_EXTRACTABLE (clip)); if (asset == NULL) { gchar *id; - NewAssetUData *mudata = g_slice_new (NewAssetUData); + NewAssetUData *mudata = g_new (NewAssetUData, 1); mudata->clip = clip; mudata->layer = layer; @@ -743,7 +743,7 @@ ges_layer_add_clip_full (GESLayer * layer, GESClip * clip, GError ** error) ges_extractable_set_asset (GES_EXTRACTABLE (clip), asset); - g_slice_free (NewAssetUData, mudata); + g_free (mudata); gst_clear_object (&asset); } diff --git a/subprojects/gst-editing-services/ges/ges-meta-container.c b/subprojects/gst-editing-services/ges/ges-meta-container.c index 877abd827f..c82482356b 100644 --- a/subprojects/gst-editing-services/ges/ges-meta-container.c +++ b/subprojects/gst-editing-services/ges/ges-meta-container.c @@ -110,19 +110,19 @@ _free_meta_container_data (ContainerData * data) gst_structure_free (data->structure); g_hash_table_unref (data->static_items); - g_slice_free (ContainerData, data); + g_free (data); } static void _free_static_item (RegisteredMeta * item) { - g_slice_free (RegisteredMeta, item); + g_free (item); } static ContainerData * _create_container_data (GESMetaContainer * container) { - ContainerData *data = g_slice_new (ContainerData); + ContainerData *data = g_new (ContainerData, 1); data->structure = gst_structure_new_empty ("metadatas"); data->static_items = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) (GDestroyNotify) _free_static_item); @@ -216,7 +216,7 @@ _register_meta (GESMetaContainer * container, GESMetaFlag flags, return FALSE; } - static_item = g_slice_new0 (RegisteredMeta); + static_item = g_new0 (RegisteredMeta, 1); static_item->item_type = type; static_item->flags = flags; g_hash_table_insert (data->static_items, g_strdup (meta_item), static_item); diff --git a/subprojects/gst-editing-services/ges/ges-project.c b/subprojects/gst-editing-services/ges/ges-project.c index d0efd7ce24..48e7d0ceb7 100644 --- a/subprojects/gst-editing-services/ges/ges-project.c +++ b/subprojects/gst-editing-services/ges/ges-project.c @@ -140,7 +140,7 @@ _emit_loaded_in_idle (EmitLoadedInIdle * data) gst_object_unref (data->project); gst_object_unref (data->timeline); - g_slice_free (EmitLoadedInIdle, data); + g_free (data); return FALSE; } @@ -226,7 +226,7 @@ _load_project (GESProject * project, GESTimeline * timeline, GError ** error) ges_project_set_uri (project, ges_asset_get_id (GES_ASSET (project))); GST_INFO_OBJECT (project, "Using asset ID %s as URI.", priv->uri); } else { - EmitLoadedInIdle *data = g_slice_new (EmitLoadedInIdle); + EmitLoadedInIdle *data = g_new (EmitLoadedInIdle, 1); GST_INFO_OBJECT (project, "%s, Loading an empty timeline %s" " as no URI set yet", GST_OBJECT_NAME (timeline), diff --git a/subprojects/gst-editing-services/ges/ges-smart-adder.c b/subprojects/gst-editing-services/ges/ges-smart-adder.c index 85ea017114..f9bc93e341 100644 --- a/subprojects/gst-editing-services/ges/ges-smart-adder.c +++ b/subprojects/gst-editing-services/ges/ges-smart-adder.c @@ -71,7 +71,7 @@ destroy_pad (PadInfos * infos) gst_element_release_request_pad (infos->self->adder, infos->adder_pad); gst_object_unref (infos->adder_pad); } - g_slice_free (PadInfos, infos); + g_free (infos); } /**************************************************** @@ -84,7 +84,7 @@ _request_new_pad (GstElement * element, GstPadTemplate * templ, GstPad *audioresample_srcpad, *audioconvert_sinkpad, *tmpghost; GstPad *ghost; GstElement *audioconvert, *audioresample; - PadInfos *infos = g_slice_new0 (PadInfos); + PadInfos *infos = g_new0 (PadInfos, 1); GESSmartAdder *self = GES_SMART_ADDER (element); infos->adder_pad = gst_element_request_pad (self->adder, @@ -93,7 +93,7 @@ _request_new_pad (GstElement * element, GstPadTemplate * templ, if (infos->adder_pad == NULL) { GST_WARNING_OBJECT (element, "Could not get any pad from GstAdder"); - g_slice_free (PadInfos, infos); + g_free (infos); return NULL; } diff --git a/subprojects/gst-editing-services/ges/ges-timeline-element.c b/subprojects/gst-editing-services/ges/ges-timeline-element.c index 24000a58da..7dbae9b56f 100644 --- a/subprojects/gst-editing-services/ges/ges-timeline-element.c +++ b/subprojects/gst-editing-services/ges/ges-timeline-element.c @@ -401,7 +401,7 @@ _child_prop_handler_free (ChildPropHandler * handler) if (handler->child != (GObject *) handler->self && handler->child != (GObject *) handler->owner) gst_object_unref (handler->child); - g_slice_free (ChildPropHandler, handler); + g_free (handler); } static gboolean @@ -763,7 +763,7 @@ emit_deep_notify_in_idle (EmitDeepNotifyInIdleData * data) gst_object_unref (data->child); g_param_spec_unref (data->arg); gst_object_unref (data->self); - g_slice_free (EmitDeepNotifyInIdleData, data); + g_free (data); return FALSE; } @@ -782,7 +782,7 @@ child_prop_changed_cb (GObject * child, GParamSpec * arg, return; } - data = g_slice_new (EmitDeepNotifyInIdleData); + data = g_new (EmitDeepNotifyInIdleData, 1); data->child = gst_object_ref (child); data->arg = g_param_spec_ref (arg); @@ -845,7 +845,7 @@ ges_timeline_element_add_child_property_full (GESTimelineElement * self, child, pspec->name); signame = g_strconcat ("notify::", pspec->name, NULL); - handler = (ChildPropHandler *) g_slice_new0 (ChildPropHandler); + handler = (ChildPropHandler *) g_new0 (ChildPropHandler, 1); handler->self = self; if (child == G_OBJECT (self) || child == G_OBJECT (owner)) handler->child = child; diff --git a/subprojects/gst-editing-services/ges/ges-track.c b/subprojects/gst-editing-services/ges/ges-track.c index 4a87796fdc..7c6d550a00 100644 --- a/subprojects/gst-editing-services/ges/ges-track.c +++ b/subprojects/gst-editing-services/ges/ges-track.c @@ -173,7 +173,7 @@ gap_new (GESTrack * track, GstClockTime start, GstClockTime duration) return NULL; } - new_gap = g_slice_new (Gap); + new_gap = g_new (Gap, 1); new_gap->start = start; new_gap->duration = duration; new_gap->track = track; @@ -201,7 +201,7 @@ free_gap (Gap * gap) GST_TIME_ARGS (gap->duration)); ges_nle_composition_remove_object (track->priv->composition, gap->nleobj); - g_slice_free (Gap, gap); + g_free (gap); } static inline void diff --git a/subprojects/gst-editing-services/ges/ges-xml-formatter.c b/subprojects/gst-editing-services/ges/ges-xml-formatter.c index 7814716c8a..b0fdfc9e85 100644 --- a/subprojects/gst-editing-services/ges/ges-xml-formatter.c +++ b/subprojects/gst-editing-services/ges/ges-xml-formatter.c @@ -339,7 +339,7 @@ _parse_asset (GMarkupParseContext * context, const gchar * element_name, extractable_type = g_type_from_name (extractable_type_name); if (extractable_type == GES_TYPE_TIMELINE) { - SubprojectData *subproj_data = g_malloc0 (sizeof (SubprojectData)); + SubprojectData *subproj_data = g_new0 (SubprojectData, 1); const gchar *nid; priv->subproject = subproj_data; diff --git a/subprojects/gst-editing-services/tests/check/ges/test-utils.c b/subprojects/gst-editing-services/tests/check/ges/test-utils.c index de38ae37dd..178d7e56f8 100644 --- a/subprojects/gst-editing-services/tests/check/ges/test-utils.c +++ b/subprojects/gst-editing-services/tests/check/ges/test-utils.c @@ -160,7 +160,7 @@ check_destroyed (GObject * object_to_unref, GObject * first_object, ...) { GObject *object; GList *objs = NULL, *tmp; - DestroyedObjectStruct *destroyed = g_slice_new0 (DestroyedObjectStruct); + DestroyedObjectStruct *destroyed = g_new0 (DestroyedObjectStruct, 1); destroyed->object = object_to_unref; g_object_weak_ref (object_to_unref, (GWeakNotify) weak_notify, destroyed); @@ -173,7 +173,7 @@ check_destroyed (GObject * object_to_unref, GObject * first_object, ...) va_start (varargs, first_object); while (object) { - destroyed = g_slice_new0 (DestroyedObjectStruct); + destroyed = g_new0 (DestroyedObjectStruct, 1); destroyed->object = object; g_object_weak_ref (object, (GWeakNotify) weak_notify, destroyed); objs = g_list_prepend (objs, destroyed); @@ -186,7 +186,7 @@ check_destroyed (GObject * object_to_unref, GObject * first_object, ...) for (tmp = objs; tmp; tmp = tmp->next) { fail_unless (((DestroyedObjectStruct *) tmp->data)->destroyed == TRUE, "%p is not destroyed", ((DestroyedObjectStruct *) tmp->data)->object); - g_slice_free (DestroyedObjectStruct, tmp->data); + g_free (tmp->data); } g_list_free (objs);