ges: drop use of GSlice allocator

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3784>
This commit is contained in:
Tim-Philipp Müller 2023-01-24 20:22:28 +00:00 committed by GStreamer Marge Bot
parent f8817a8e8d
commit 18a3c32323
11 changed files with 33 additions and 33 deletions

View file

@ -610,7 +610,7 @@ _free_entries (gpointer entry)
GESAssetCacheEntry *data = (GESAssetCacheEntry *) entry; GESAssetCacheEntry *data = (GESAssetCacheEntry *) entry;
if (data->asset) if (data->asset)
gst_object_unref (data->asset); gst_object_unref (data->asset);
g_slice_free (GESAssetCacheEntry, entry); g_free (entry);
} }
static void static void
@ -740,7 +740,7 @@ ges_asset_cache_put (GESAsset * asset, GTask * task)
g_strdup (_extractable_type_name (extractable_type)), entries_table); g_strdup (_extractable_type_name (extractable_type)), entries_table);
} }
entry = g_slice_new0 (GESAssetCacheEntry); entry = g_new0 (GESAssetCacheEntry, 1);
/* transfer asset to entry */ /* transfer asset to entry */
entry->asset = asset; entry->asset = asset;

View file

@ -124,7 +124,7 @@ static void
_free_layer_entry (LayerEntry * entry) _free_layer_entry (LayerEntry * entry)
{ {
gst_object_unref (entry->layer); gst_object_unref (entry->layer);
g_slice_free (LayerEntry, entry); g_free (entry);
} }
static void static void
@ -133,7 +133,7 @@ _free_pending_group (PendingGroup * pgroup)
if (pgroup->group) if (pgroup->group)
g_object_unref (pgroup->group); g_object_unref (pgroup->group);
g_list_free_full (pgroup->pending_children, g_free); g_list_free_full (pgroup->pending_children, g_free);
g_slice_free (PendingGroup, pgroup); g_free (pgroup);
} }
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GESBaseXmlFormatter, G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GESBaseXmlFormatter,
@ -663,7 +663,7 @@ _free_pending_asset (GESBaseXmlFormatterPrivate * priv, PendingAsset * passet)
gst_structure_free (passet->properties); gst_structure_free (passet->properties);
priv->pending_assets = g_list_remove (priv->pending_assets, passet); priv->pending_assets = g_list_remove (priv->pending_assets, passet);
g_slice_free (PendingAsset, passet); g_free (passet);
} }
static void static void
@ -842,7 +842,7 @@ ges_base_xml_formatter_add_asset (GESBaseXmlFormatter * self,
return; return;
} }
passet = g_slice_new0 (PendingAsset); passet = g_new0 (PendingAsset, 1);
passet->metadatas = g_strdup (metadatas); passet->metadatas = g_strdup (metadatas);
passet->id = g_strdup (id); passet->id = g_strdup (id);
passet->extractable_type = extractable_type; passet->extractable_type = extractable_type;
@ -1005,7 +1005,7 @@ ges_base_xml_formatter_add_layer (GESBaseXmlFormatter * self,
g_list_free (tracks); g_list_free (tracks);
} }
entry = g_slice_new0 (LayerEntry); entry = g_new0 (LayerEntry, 1);
entry->layer = gst_object_ref (layer); entry->layer = gst_object_ref (layer);
entry->auto_trans = auto_transition; entry->auto_trans = auto_transition;
@ -1292,7 +1292,7 @@ ges_base_xml_formatter_add_group (GESBaseXmlFormatter * self,
return; return;
} }
pgroup = g_slice_new0 (PendingGroup); pgroup = g_new0 (PendingGroup, 1);
pgroup->group = ges_group_new (); pgroup->group = ges_group_new ();
if (metadatas) if (metadatas)

View file

@ -127,7 +127,7 @@ _free_mapping (ChildMapping * mapping)
gst_object_unref (child); gst_object_unref (child);
} }
g_slice_free (ChildMapping, mapping); g_free (mapping);
} }
static gint static gint
@ -347,7 +347,7 @@ _deep_copy (GESTimelineElement * element, GESTimelineElement * copy)
for (tmp = GES_CONTAINER_CHILDREN (element); tmp; tmp = tmp->next) { for (tmp = GES_CONTAINER_CHILDREN (element); tmp; tmp = tmp->next) {
ChildMapping *map, *orig_map; ChildMapping *map, *orig_map;
orig_map = g_hash_table_lookup (self->priv->mappings, tmp->data); 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->child = ges_timeline_element_copy (tmp->data, TRUE);
map->start_offset = orig_map->start_offset; 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); mapping->child = gst_object_ref (child);
g_hash_table_insert (priv->mappings, child, mapping); g_hash_table_insert (priv->mappings, child, mapping);
container->children = g_list_append (container->children, child); container->children = g_list_append (container->children, child);

View file

@ -434,7 +434,7 @@ new_asset_cb (GESAsset * source, GAsyncResult * res, NewAssetUData * udata)
gst_object_unref (asset); gst_object_unref (asset);
gst_object_unref (udata->clip); 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)); asset = ges_extractable_get_asset (GES_EXTRACTABLE (clip));
if (asset == NULL) { if (asset == NULL) {
gchar *id; gchar *id;
NewAssetUData *mudata = g_slice_new (NewAssetUData); NewAssetUData *mudata = g_new (NewAssetUData, 1);
mudata->clip = clip; mudata->clip = clip;
mudata->layer = layer; 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); ges_extractable_set_asset (GES_EXTRACTABLE (clip), asset);
g_slice_free (NewAssetUData, mudata); g_free (mudata);
gst_clear_object (&asset); gst_clear_object (&asset);
} }

View file

@ -110,19 +110,19 @@ _free_meta_container_data (ContainerData * data)
gst_structure_free (data->structure); gst_structure_free (data->structure);
g_hash_table_unref (data->static_items); g_hash_table_unref (data->static_items);
g_slice_free (ContainerData, data); g_free (data);
} }
static void static void
_free_static_item (RegisteredMeta * item) _free_static_item (RegisteredMeta * item)
{ {
g_slice_free (RegisteredMeta, item); g_free (item);
} }
static ContainerData * static ContainerData *
_create_container_data (GESMetaContainer * container) _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->structure = gst_structure_new_empty ("metadatas");
data->static_items = g_hash_table_new_full (g_str_hash, g_str_equal, data->static_items = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, (GDestroyNotify) (GDestroyNotify) _free_static_item); g_free, (GDestroyNotify) (GDestroyNotify) _free_static_item);
@ -216,7 +216,7 @@ _register_meta (GESMetaContainer * container, GESMetaFlag flags,
return FALSE; return FALSE;
} }
static_item = g_slice_new0 (RegisteredMeta); static_item = g_new0 (RegisteredMeta, 1);
static_item->item_type = type; static_item->item_type = type;
static_item->flags = flags; static_item->flags = flags;
g_hash_table_insert (data->static_items, g_strdup (meta_item), static_item); g_hash_table_insert (data->static_items, g_strdup (meta_item), static_item);

View file

@ -140,7 +140,7 @@ _emit_loaded_in_idle (EmitLoadedInIdle * data)
gst_object_unref (data->project); gst_object_unref (data->project);
gst_object_unref (data->timeline); gst_object_unref (data->timeline);
g_slice_free (EmitLoadedInIdle, data); g_free (data);
return FALSE; 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))); ges_project_set_uri (project, ges_asset_get_id (GES_ASSET (project)));
GST_INFO_OBJECT (project, "Using asset ID %s as URI.", priv->uri); GST_INFO_OBJECT (project, "Using asset ID %s as URI.", priv->uri);
} else { } else {
EmitLoadedInIdle *data = g_slice_new (EmitLoadedInIdle); EmitLoadedInIdle *data = g_new (EmitLoadedInIdle, 1);
GST_INFO_OBJECT (project, "%s, Loading an empty timeline %s" GST_INFO_OBJECT (project, "%s, Loading an empty timeline %s"
" as no URI set yet", GST_OBJECT_NAME (timeline), " as no URI set yet", GST_OBJECT_NAME (timeline),

View file

@ -71,7 +71,7 @@ destroy_pad (PadInfos * infos)
gst_element_release_request_pad (infos->self->adder, infos->adder_pad); gst_element_release_request_pad (infos->self->adder, infos->adder_pad);
gst_object_unref (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 *audioresample_srcpad, *audioconvert_sinkpad, *tmpghost;
GstPad *ghost; GstPad *ghost;
GstElement *audioconvert, *audioresample; GstElement *audioconvert, *audioresample;
PadInfos *infos = g_slice_new0 (PadInfos); PadInfos *infos = g_new0 (PadInfos, 1);
GESSmartAdder *self = GES_SMART_ADDER (element); GESSmartAdder *self = GES_SMART_ADDER (element);
infos->adder_pad = gst_element_request_pad (self->adder, 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) { if (infos->adder_pad == NULL) {
GST_WARNING_OBJECT (element, "Could not get any pad from GstAdder"); GST_WARNING_OBJECT (element, "Could not get any pad from GstAdder");
g_slice_free (PadInfos, infos); g_free (infos);
return NULL; return NULL;
} }

View file

@ -401,7 +401,7 @@ _child_prop_handler_free (ChildPropHandler * handler)
if (handler->child != (GObject *) handler->self && if (handler->child != (GObject *) handler->self &&
handler->child != (GObject *) handler->owner) handler->child != (GObject *) handler->owner)
gst_object_unref (handler->child); gst_object_unref (handler->child);
g_slice_free (ChildPropHandler, handler); g_free (handler);
} }
static gboolean static gboolean
@ -763,7 +763,7 @@ emit_deep_notify_in_idle (EmitDeepNotifyInIdleData * data)
gst_object_unref (data->child); gst_object_unref (data->child);
g_param_spec_unref (data->arg); g_param_spec_unref (data->arg);
gst_object_unref (data->self); gst_object_unref (data->self);
g_slice_free (EmitDeepNotifyInIdleData, data); g_free (data);
return FALSE; return FALSE;
} }
@ -782,7 +782,7 @@ child_prop_changed_cb (GObject * child, GParamSpec * arg,
return; return;
} }
data = g_slice_new (EmitDeepNotifyInIdleData); data = g_new (EmitDeepNotifyInIdleData, 1);
data->child = gst_object_ref (child); data->child = gst_object_ref (child);
data->arg = g_param_spec_ref (arg); data->arg = g_param_spec_ref (arg);
@ -845,7 +845,7 @@ ges_timeline_element_add_child_property_full (GESTimelineElement * self,
child, pspec->name); child, pspec->name);
signame = g_strconcat ("notify::", pspec->name, NULL); signame = g_strconcat ("notify::", pspec->name, NULL);
handler = (ChildPropHandler *) g_slice_new0 (ChildPropHandler); handler = (ChildPropHandler *) g_new0 (ChildPropHandler, 1);
handler->self = self; handler->self = self;
if (child == G_OBJECT (self) || child == G_OBJECT (owner)) if (child == G_OBJECT (self) || child == G_OBJECT (owner))
handler->child = child; handler->child = child;

View file

@ -173,7 +173,7 @@ gap_new (GESTrack * track, GstClockTime start, GstClockTime duration)
return NULL; return NULL;
} }
new_gap = g_slice_new (Gap); new_gap = g_new (Gap, 1);
new_gap->start = start; new_gap->start = start;
new_gap->duration = duration; new_gap->duration = duration;
new_gap->track = track; new_gap->track = track;
@ -201,7 +201,7 @@ free_gap (Gap * gap)
GST_TIME_ARGS (gap->duration)); GST_TIME_ARGS (gap->duration));
ges_nle_composition_remove_object (track->priv->composition, gap->nleobj); ges_nle_composition_remove_object (track->priv->composition, gap->nleobj);
g_slice_free (Gap, gap); g_free (gap);
} }
static inline void static inline void

View file

@ -339,7 +339,7 @@ _parse_asset (GMarkupParseContext * context, const gchar * element_name,
extractable_type = g_type_from_name (extractable_type_name); extractable_type = g_type_from_name (extractable_type_name);
if (extractable_type == GES_TYPE_TIMELINE) { if (extractable_type == GES_TYPE_TIMELINE) {
SubprojectData *subproj_data = g_malloc0 (sizeof (SubprojectData)); SubprojectData *subproj_data = g_new0 (SubprojectData, 1);
const gchar *nid; const gchar *nid;
priv->subproject = subproj_data; priv->subproject = subproj_data;

View file

@ -160,7 +160,7 @@ check_destroyed (GObject * object_to_unref, GObject * first_object, ...)
{ {
GObject *object; GObject *object;
GList *objs = NULL, *tmp; GList *objs = NULL, *tmp;
DestroyedObjectStruct *destroyed = g_slice_new0 (DestroyedObjectStruct); DestroyedObjectStruct *destroyed = g_new0 (DestroyedObjectStruct, 1);
destroyed->object = object_to_unref; destroyed->object = object_to_unref;
g_object_weak_ref (object_to_unref, (GWeakNotify) weak_notify, destroyed); 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); va_start (varargs, first_object);
while (object) { while (object) {
destroyed = g_slice_new0 (DestroyedObjectStruct); destroyed = g_new0 (DestroyedObjectStruct, 1);
destroyed->object = object; destroyed->object = object;
g_object_weak_ref (object, (GWeakNotify) weak_notify, destroyed); g_object_weak_ref (object, (GWeakNotify) weak_notify, destroyed);
objs = g_list_prepend (objs, 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) { for (tmp = objs; tmp; tmp = tmp->next) {
fail_unless (((DestroyedObjectStruct *) tmp->data)->destroyed == TRUE, fail_unless (((DestroyedObjectStruct *) tmp->data)->destroyed == TRUE,
"%p is not destroyed", ((DestroyedObjectStruct *) tmp->data)->object); "%p is not destroyed", ((DestroyedObjectStruct *) tmp->data)->object);
g_slice_free (DestroyedObjectStruct, tmp->data); g_free (tmp->data);
} }
g_list_free (objs); g_list_free (objs);