validate: 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 21:17:30 +00:00 committed by GStreamer Marge Bot
parent cae6c6c73a
commit 7679011d1d
12 changed files with 54 additions and 55 deletions

View file

@ -84,7 +84,7 @@ ssim_convert_info_free (SSimConverterInfo * info)
if (info->converter)
gst_video_converter_free (info->converter);
g_slice_free (SSimConverterInfo, info);
g_free (info);
}
static gboolean
@ -256,7 +256,7 @@ gst_validate_ssim_configure_converter (GstValidateSsim * self, gint index,
SSimConverterInfo *info = g_list_nth_data (self->priv->converters, index);
if (!info) {
info = g_slice_new0 (SSimConverterInfo);
info = g_new0 (SSimConverterInfo, 1);
self->priv->converters =
g_list_insert (self->priv->converters, info, index);

View file

@ -682,7 +682,7 @@ setup_input_selector_counters (GstElement * element)
switch (gst_iterator_next (iterator, &value)) {
case GST_ITERATOR_OK:
pad = g_value_dup_object (&value);
bcd = g_slice_new0 (BufferCountData);
bcd = g_new0 (BufferCountData, 1);
g_object_set_data (G_OBJECT (pad), "buffer-count-data", bcd);
bcd->probe_id = gst_pad_add_probe (pad, GST_PAD_PROBE_TYPE_BUFFER,
(GstPadProbeCallback) input_selector_pad_probe, NULL, NULL);
@ -791,7 +791,7 @@ check_and_remove_input_selector_counters (GstElement * element,
for (id = 0; id < element->numpads; ++id) {
gst_object_unref (bcds[id]->pad);
g_slice_free (BufferCountData, bcds[id]);
g_free (bcds[id]);
}
g_free (bcds);
return ret;

View file

@ -65,7 +65,7 @@ static void
g_free (entry->name);
g_object_unref (entry->override);
g_slice_free (GstValidateOverrideRegistryNameEntry, entry);
g_free (entry);
}
static void
@ -74,13 +74,13 @@ static void
{
g_object_unref (entry->override);
g_slice_free (GstValidateOverrideRegistryGTypeEntry, entry);
g_free (entry);
}
static GstValidateOverrideRegistry *
gst_validate_override_registry_new (void)
{
GstValidateOverrideRegistry *reg = g_slice_new0 (GstValidateOverrideRegistry);
GstValidateOverrideRegistry *reg = g_new0 (GstValidateOverrideRegistry, 1);
g_mutex_init (&reg->mutex);
g_queue_init (&reg->name_overrides);
@ -107,7 +107,7 @@ gst_validate_overide_registery_free (GstValidateOverrideRegistry * reg)
g_queue_clear (&reg->klass_overrides);
g_mutex_clear (&reg->mutex);
g_slice_free (GstValidateOverrideRegistry, reg);
g_free (reg);
}
/**
@ -131,7 +131,7 @@ gst_validate_override_register_by_name (const gchar * name,
{
GstValidateOverrideRegistry *registry = gst_validate_override_registry_get ();
GstValidateOverrideRegistryNameEntry *entry =
g_slice_new (GstValidateOverrideRegistryNameEntry);
g_new (GstValidateOverrideRegistryNameEntry, 1);
GST_VALIDATE_OVERRIDE_REGISTRY_LOCK (registry);
entry->name = g_strdup (name);
@ -146,7 +146,7 @@ gst_validate_override_register_by_type (GType gtype,
{
GstValidateOverrideRegistry *registry = gst_validate_override_registry_get ();
GstValidateOverrideRegistryGTypeEntry *entry =
g_slice_new (GstValidateOverrideRegistryGTypeEntry);
g_new (GstValidateOverrideRegistryGTypeEntry, 1);
GST_VALIDATE_OVERRIDE_REGISTRY_LOCK (registry);
entry->gtype = gtype;
@ -161,7 +161,7 @@ gst_validate_override_register_by_klass (const gchar * klass,
{
GstValidateOverrideRegistry *registry = gst_validate_override_registry_get ();
GstValidateOverrideRegistryNameEntry *entry =
g_slice_new (GstValidateOverrideRegistryNameEntry);
g_new (GstValidateOverrideRegistryNameEntry, 1);
GST_VALIDATE_OVERRIDE_REGISTRY_LOCK (registry);
entry->name = g_strdup (klass);

View file

@ -353,7 +353,7 @@ static void
_serialized_event_data_free (SerializedEventData * serialized_event)
{
gst_event_unref (serialized_event->event);
g_slice_free (SerializedEventData, serialized_event);
g_free (serialized_event);
}
static gboolean gst_validate_pad_monitor_do_setup (GstValidateMonitor *
@ -894,7 +894,7 @@ gst_validate_pad_monitor_check_late_serialized_events (GstValidatePadMonitor *
static void
seek_data_free (GstValidatePadSeekData * data)
{
g_slice_free (GstValidatePadSeekData, data);
g_free (data);
}
static GstValidatePadSeekData *
@ -1505,7 +1505,7 @@ static void
otherpad = g_value_get_object (&value);
othermonitor = _GET_PAD_MONITOR (otherpad);
if (othermonitor) {
SerializedEventData *data = g_slice_new0 (SerializedEventData);
SerializedEventData *data = g_new0 (SerializedEventData, 1);
data->timestamp = last_ts;
data->event = gst_event_ref (event);
GST_VALIDATE_MONITOR_LOCK (othermonitor);
@ -2151,7 +2151,7 @@ gst_validate_pad_monitor_downstream_event_check (GstValidatePadMonitor *
static GstValidatePadSeekData *
_store_seek_event_data (GstValidatePadMonitor * pad_monitor, GstEvent * event)
{
GstValidatePadSeekData *data = g_slice_new0 (GstValidatePadSeekData);
GstValidatePadSeekData *data = g_new0 (GstValidatePadSeekData, 1);
data->seqnum = gst_event_get_seqnum (event);
gst_event_parse_seek (event, &data->rate, &data->format, &data->flags,
@ -2190,7 +2190,7 @@ gst_validate_pad_monitor_src_event_check (GstValidatePadMonitor * pad_monitor,
/* Remove failed seek from list */
GST_LOG_OBJECT (pad, "Failed seek, removing stored seek data");
pad_monitor->seeks = g_list_remove (pad_monitor->seeks, seekdata);
g_slice_free (GstValidatePadSeekData, seekdata);
g_free (seekdata);
}
}

View file

@ -136,7 +136,7 @@ gst_validate_issue_unref (GstValidateIssue * issue)
/* We are using an string array for area and name */
g_strfreev (&issue->area);
g_slice_free (GstValidateIssue, issue);
g_free (issue);
}
}
@ -250,7 +250,7 @@ gst_validate_issue_new_full (GstValidateIssueId issue_id, const gchar * summary,
return NULL;
}
issue = g_slice_new (GstValidateIssue);
issue = g_new (GstValidateIssue, 1);
issue->issue_id = issue_id;
issue->summary = g_strdup (summary);
issue->description = g_strdup (description);
@ -287,7 +287,7 @@ gst_validate_issue_new (GstValidateIssueId issue_id, const gchar * summary,
return NULL;
}
issue = g_slice_new (GstValidateIssue);
issue = g_new (GstValidateIssue, 1);
issue->issue_id = issue_id;
issue->summary = g_strdup (summary);
issue->description = g_strdup (description);
@ -854,7 +854,7 @@ _report_free (GstValidateReport * report)
g_list_free_full (report->repeated_reports,
(GDestroyNotify) gst_validate_report_unref);
g_mutex_clear (&report->shadow_reports_lock);
g_slice_free (GstValidateReport, report);
g_free (report);
}
static gboolean
@ -889,7 +889,7 @@ GstValidateReport *
gst_validate_report_new (GstValidateIssue * issue,
GstValidateReporter * reporter, const gchar * message)
{
GstValidateReport *report = g_slice_new0 (GstValidateReport);
GstValidateReport *report = g_new0 (GstValidateReport, 1);
GstValidateReportingDetails reporter_details, default_details,
issue_type_details;
GstValidateRunner *runner = gst_validate_reporter_get_runner (reporter);

View file

@ -73,7 +73,7 @@ _free_priv (GstValidateReporterPrivate * priv)
g_free (priv->name);
g_mutex_clear (&priv->reports_lock);
g_weak_ref_clear (&priv->runner);
g_slice_free (GstValidateReporterPrivate, priv);
g_free (priv);
}
static GstValidateReporterPrivate *
@ -84,7 +84,7 @@ gst_validate_reporter_get_priv (GstValidateReporter * reporter)
priv = g_object_get_data (G_OBJECT (reporter), REPORTER_PRIVATE);
if (priv == NULL) {
priv = g_slice_new0 (GstValidateReporterPrivate);
priv = g_new0 (GstValidateReporterPrivate, 1);
priv->reports = g_hash_table_new_full (g_direct_hash,
g_direct_equal, NULL, (GDestroyNotify) gst_validate_report_unref);

View file

@ -236,7 +236,7 @@ static void
_set_reporting_level_for_name (GstValidateRunner * runner,
const gchar * pattern, GstValidateReportingDetails level)
{
PatternLevel *pattern_level = g_malloc (sizeof (PatternLevel));
PatternLevel *pattern_level = g_new (PatternLevel, 1);
GPatternSpec *pattern_spec = g_pattern_spec_new (pattern);
pattern_level->pattern = pattern_spec;

View file

@ -499,8 +499,8 @@ _action_free (GstValidateAction * action)
g_free (GST_VALIDATE_ACTION_FILENAME (action));
g_free (GST_VALIDATE_ACTION_DEBUG (action));
g_slice_free (GstValidateActionPrivate, action->priv);
g_slice_free (GstValidateAction, action);
g_free (action->priv);
g_free (action);
}
static void
@ -510,7 +510,7 @@ gst_validate_action_init (GstValidateAction * action)
_gst_validate_action_type, (GstMiniObjectCopyFunction) _action_copy, NULL,
(GstMiniObjectFreeFunction) _action_free);
action->priv = g_slice_new0 (GstValidateActionPrivate);
action->priv = g_new0 (GstValidateActionPrivate, 1);
g_weak_ref_init (&action->priv->scenario, NULL);
}
@ -541,7 +541,7 @@ gst_validate_action_new (GstValidateScenario * scenario,
GstValidateActionType * action_type, GstStructure * structure,
gboolean add_to_lists)
{
GstValidateAction *action = g_slice_new0 (GstValidateAction);
GstValidateAction *action = g_new0 (GstValidateAction, 1);
g_assert (action_type);
@ -616,7 +616,7 @@ _action_type_free (GstValidateActionType * type)
if (type->overriden_type)
gst_mini_object_unref (GST_MINI_OBJECT (type->overriden_type));
g_slice_free (GstValidateActionType, type);
g_free (type);
}
static void
@ -632,7 +632,7 @@ gst_validate_action_type_init (GstValidateActionType * type)
GstValidateActionType *
gst_validate_action_type_new (void)
{
GstValidateActionType *type = g_slice_new0 (GstValidateActionType);
GstValidateActionType *type = g_new0 (GstValidateActionType, 1);
gst_validate_action_type_init (type);

View file

@ -85,7 +85,7 @@ deserialize_streamnode (const gchar ** names, const gchar ** values)
{
gint i;
GstValidateMediaStreamNode
* streamnode = g_slice_new0 (GstValidateMediaStreamNode);
* streamnode = g_new0 (GstValidateMediaStreamNode, 1);
for (i = 0; names[i] != NULL; i++) {
if (g_strcmp0 (names[i], "id") == 0)
@ -104,7 +104,7 @@ static GstValidateSegmentNode *
deserialize_segmentnode (const gchar ** names, const gchar ** values)
{
gint i;
GstValidateSegmentNode *node = g_slice_new0 (GstValidateSegmentNode);
GstValidateSegmentNode *node = g_new0 (GstValidateSegmentNode, 1);
for (i = 0; names[i] != NULL; i++) {
if (!g_strcmp0 (names[i], "next-frame-id"))
@ -139,7 +139,7 @@ deserialize_segmentnode (const gchar ** names, const gchar ** values)
static GstValidateMediaTagsNode *
deserialize_tagsnode (const gchar ** names, const gchar ** values)
{
GstValidateMediaTagsNode *tagsnode = g_slice_new0 (GstValidateMediaTagsNode);
GstValidateMediaTagsNode *tagsnode = g_new0 (GstValidateMediaTagsNode, 1);
return tagsnode;
}
@ -148,7 +148,7 @@ static GstValidateMediaTagNode *
deserialize_tagnode (const gchar ** names, const gchar ** values)
{
gint i;
GstValidateMediaTagNode *tagnode = g_slice_new0 (GstValidateMediaTagNode);
GstValidateMediaTagNode *tagnode = g_new0 (GstValidateMediaTagNode, 1);
for (i = 0; names[i] != NULL; i++) {
if (g_strcmp0 (names[i], "content") == 0)
@ -163,8 +163,7 @@ deserialize_framenode (const gchar ** names, const gchar ** values)
{
gint i;
GstValidateMediaFrameNode *framenode =
g_slice_new0 (GstValidateMediaFrameNode);
GstValidateMediaFrameNode *framenode = g_new0 (GstValidateMediaFrameNode, 1);
/* *INDENT-OFF* */
#define IF_SET_UINT64_FIELD(name,fieldname) \

View file

@ -282,7 +282,7 @@ static gboolean
g_return_val_if_fail (gst_validate_media_descriptor_get_file_node (
(GstValidateMediaDescriptor *) writer), FALSE);
snode = g_slice_new0 (GstValidateMediaStreamNode);
snode = g_new0 (GstValidateMediaStreamNode, 1);
snode->frames = NULL;
snode->cframe = NULL;
@ -291,7 +291,7 @@ static gboolean
caps = gst_discoverer_stream_info_get_caps (info);
capsstr = gst_caps_to_string (caps);
g_slice_free (GstValidateMediaStreamNode, snode);
g_free (snode);
GST_VALIDATE_REPORT (writer, FILE_NO_STREAM_ID,
"Stream with caps: %s has no stream ID", capsstr);
gst_caps_unref (caps);
@ -363,7 +363,7 @@ _uridecodebin_probe (GstPad * pad, GstPadProbeInfo * info,
writer, pad);
if (streamnode) {
GstValidateSegmentNode *segment_node =
g_slice_new0 (GstValidateSegmentNode);
g_new0 (GstValidateSegmentNode, 1);
gst_event_parse_segment (event, &segment);
gst_segment_copy_into (segment, &segment_node->segment);
@ -821,7 +821,7 @@ gst_validate_media_descriptor_writer_add_tags (GstValidateMediaDescriptorWriter
}
if (snode->tags == NULL) {
tagsnode = g_slice_new0 (GstValidateMediaTagsNode);
tagsnode = g_new0 (GstValidateMediaTagsNode, 1);
tagsnode->str_open = g_markup_printf_escaped ("<tags>");
tagsnode->str_close = g_markup_printf_escaped ("</tags>");
snode->tags = tagsnode;
@ -838,7 +838,7 @@ gst_validate_media_descriptor_writer_add_tags (GstValidateMediaDescriptorWriter
}
}
tagnode = g_slice_new0 (GstValidateMediaTagNode);
tagnode = g_new0 (GstValidateMediaTagNode, 1);
tagnode->taglist = gst_tag_list_copy (taglist);
str_str = gst_tag_list_to_string (tagnode->taglist);
tagnode->str_open =
@ -877,7 +877,7 @@ gst_validate_media_descriptor_writer_add_pad (GstValidateMediaDescriptorWriter *
}
}
snode = g_slice_new0 (GstValidateMediaStreamNode);
snode = g_new0 (GstValidateMediaStreamNode, 1);
snode->frames = NULL;
snode->cframe = NULL;
@ -921,7 +921,7 @@ gboolean
if (gst_validate_media_descriptor_get_file_node ((GstValidateMediaDescriptor
*) writer)->tags == NULL) {
tagsnode = g_slice_new0 (GstValidateMediaTagsNode);
tagsnode = g_new0 (GstValidateMediaTagsNode, 1);
tagsnode->str_open = g_markup_printf_escaped ("<tags>");
tagsnode->str_close = g_markup_printf_escaped ("</tags>");
gst_validate_media_descriptor_get_file_node ((GstValidateMediaDescriptor *)
@ -940,7 +940,7 @@ gboolean
}
}
tagnode = g_slice_new0 (GstValidateMediaTagNode);
tagnode = g_new0 (GstValidateMediaTagNode, 1);
tagnode->taglist = gst_tag_list_copy (taglist);
str_str = gst_tag_list_to_string (tagnode->taglist);
tagnode->str_open =
@ -987,7 +987,7 @@ gst_validate_media_descriptor_writer_add_frame (GstValidateMediaDescriptorWriter
}
id = g_list_length (streamnode->frames);
fnode = g_slice_new0 (GstValidateMediaFrameNode);
fnode = g_new0 (GstValidateMediaFrameNode, 1);
g_assert (gst_buffer_map (buf, &map, GST_MAP_READ));
checksum = g_compute_checksum_for_data (G_CHECKSUM_MD5,

View file

@ -46,7 +46,7 @@ free_tagnode (GstValidateMediaTagNode * tagnode)
if (tagnode->taglist)
gst_tag_list_unref (tagnode->taglist);
g_slice_free (GstValidateMediaTagNode, tagnode);
g_free (tagnode);
}
static inline void
@ -55,7 +55,7 @@ free_tagsnode (GstValidateMediaTagsNode * tagsnode)
g_free (tagsnode->str_open);
g_free (tagsnode->str_close);
g_list_free_full (tagsnode->tags, (GDestroyNotify) free_tagnode);
g_slice_free (GstValidateMediaTagsNode, tagsnode);
g_free (tagsnode);
}
static inline void
@ -67,7 +67,7 @@ free_framenode (GstValidateMediaFrameNode * framenode)
if (framenode->buf)
gst_buffer_unref (framenode->buf);
g_slice_free (GstValidateMediaFrameNode, framenode);
g_free (framenode);
}
static inline void
@ -76,7 +76,7 @@ free_segmentnode (GstValidateSegmentNode * segmentnode)
g_free (segmentnode->str_open);
g_free (segmentnode->str_close);
g_slice_free (GstValidateSegmentNode, segmentnode);
g_free (segmentnode);
}
static inline void
@ -98,7 +98,7 @@ free_streamnode (GstValidateMediaStreamNode * streamnode)
g_free (streamnode->id);
g_free (streamnode->str_open);
g_free (streamnode->str_close);
g_slice_free (GstValidateMediaStreamNode, streamnode);
g_free (streamnode);
}
void
@ -116,7 +116,7 @@ gst_validate_filenode_free (GstValidateMediaFileNode * filenode)
g_free (filenode->str_open);
g_free (filenode->str_close);
g_slice_free (GstValidateMediaFileNode, filenode);
g_free (filenode);
}
gboolean
@ -162,7 +162,7 @@ static void
gst_validate_media_descriptor_init (GstValidateMediaDescriptor * self)
{
self->priv = gst_validate_media_descriptor_get_instance_private (self);
self->priv->filenode = g_slice_new0 (GstValidateMediaFileNode);
self->priv->filenode = g_new0 (GstValidateMediaFileNode, 1);
}
static void

View file

@ -37,7 +37,7 @@ check_destroyed (gpointer object_to_unref, gpointer first_object, ...)
gint i = 0;
GObject *object;
GList *objs = NULL, *tmp;
DestroyedObjectStruct *destroyed = g_slice_new0 (DestroyedObjectStruct);
DestroyedObjectStruct *destroyed = g_new0 (DestroyedObjectStruct, 1);
destroyed->object = G_OBJECT (object_to_unref);
g_object_weak_ref (G_OBJECT (object_to_unref), (GWeakNotify) weak_notify,
@ -51,7 +51,7 @@ check_destroyed (gpointer object_to_unref, gpointer 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_append (objs, destroyed);
@ -65,7 +65,7 @@ check_destroyed (gpointer object_to_unref, gpointer first_object, ...)
fail_unless (((DestroyedObjectStruct *) tmp->data)->destroyed == TRUE,
"%p is not destroyed (object nb %i)",
((DestroyedObjectStruct *) tmp->data)->object, i);
g_slice_free (DestroyedObjectStruct, tmp->data);
g_free (tmp->data);
i++;
}
g_list_free (objs);