tracers: drop use of GSlice

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3695>
This commit is contained in:
Tim-Philipp Müller 2023-01-08 01:31:21 +00:00 committed by GStreamer Marge Bot
parent 78149326c9
commit ed78e55bc7
3 changed files with 11 additions and 11 deletions

View file

@ -74,13 +74,13 @@ static GPrivate thread_stats_key = G_PRIVATE_INIT (free_thread_stats);
static void static void
free_trace_value (gpointer data) free_trace_value (gpointer data)
{ {
g_slice_free (GstTraceValue, data); g_free (data);
} }
static GstTraceValues * static GstTraceValues *
make_trace_values (GstClockTime window) make_trace_values (GstClockTime window)
{ {
GstTraceValues *self = g_slice_new0 (GstTraceValues); GstTraceValues *self = g_new0 (GstTraceValues, 1);
self->window = window; self->window = window;
g_queue_init (&self->values); g_queue_init (&self->values);
return self; return self;
@ -91,7 +91,7 @@ free_trace_values (GstTraceValues * self)
{ {
g_queue_foreach (&self->values, (GFunc) free_trace_value, NULL); g_queue_foreach (&self->values, (GFunc) free_trace_value, NULL);
g_queue_clear (&self->values); g_queue_clear (&self->values);
g_slice_free (GstTraceValues, self); g_free (self);
} }
static gboolean static gboolean
@ -136,7 +136,7 @@ update_trace_value (GstTraceValues * self, GstClockTime nts,
lv = q->head ? q->head->data : NULL; lv = q->head ? q->head->data : NULL;
if (!lv || (GST_CLOCK_DIFF (lv->ts, nts) > (window / WINDOW_SUBDIV))) { if (!lv || (GST_CLOCK_DIFF (lv->ts, nts) > (window / WINDOW_SUBDIV))) {
/* push the new measurement */ /* push the new measurement */
lv = g_slice_new0 (GstTraceValue); lv = g_new0 (GstTraceValue, 1);
lv->ts = nts; lv->ts = nts;
lv->val = nval; lv->val = nval;
g_queue_push_head (q, lv); g_queue_push_head (q, lv);

View file

@ -84,7 +84,7 @@ static GstElementStats no_elem_stats = { 0, };
static GstElementStats * static GstElementStats *
fill_element_stats (GstStatsTracer * self, GstElement * element) fill_element_stats (GstStatsTracer * self, GstElement * element)
{ {
GstElementStats *stats = g_slice_new0 (GstElementStats); GstElementStats *stats = g_new0 (GstElementStats, 1);
stats->index = self->num_elements++; stats->index = self->num_elements++;
stats->parent_ix = G_MAXUINT; stats->parent_ix = G_MAXUINT;
@ -103,7 +103,7 @@ log_new_element_stats (GstElementStats * stats, GstElement * element,
static void static void
free_element_stats (gpointer data) free_element_stats (gpointer data)
{ {
g_slice_free (GstElementStats, data); g_free (data);
} }
static GstElementStats * static GstElementStats *
@ -186,7 +186,7 @@ static GstPadStats no_pad_stats = { 0, };
static GstPadStats * static GstPadStats *
fill_pad_stats (GstStatsTracer * self, GstPad * pad) fill_pad_stats (GstStatsTracer * self, GstPad * pad)
{ {
GstPadStats *stats = g_slice_new0 (GstPadStats); GstPadStats *stats = g_new0 (GstPadStats, 1);
stats->index = self->num_pads++; stats->index = self->num_pads++;
stats->parent_ix = G_MAXUINT; stats->parent_ix = G_MAXUINT;
@ -206,7 +206,7 @@ log_new_pad_stats (GstPadStats * stats, GstPad * pad)
static void static void
free_pad_stats (gpointer data) free_pad_stats (gpointer data)
{ {
g_slice_free (GstPadStats, data); g_free (data);
} }
static GstPadStats * static GstPadStats *

View file

@ -174,7 +174,7 @@ free_latency_stats (gpointer data)
GstLatencyStats *ls = data; GstLatencyStats *ls = data;
g_free (ls->name); g_free (ls->name);
g_slice_free (GstLatencyStats, data); g_free (data);
} }
static void static void
@ -304,7 +304,7 @@ free_thread_stats (gpointer data)
static GstPluginStats * static GstPluginStats *
new_plugin_stats (const gchar * plugin_name) new_plugin_stats (const gchar * plugin_name)
{ {
GstPluginStats *plugin = g_slice_new (GstPluginStats); GstPluginStats *plugin = g_new0 (GstPluginStats, 1);
guint i; guint i;
plugin->name = g_strdup (plugin_name); plugin->name = g_strdup (plugin_name);
@ -328,7 +328,7 @@ free_plugin_stats (gpointer data)
for (i = 0; i < N_FACTORY_TYPES; i++) for (i = 0; i < N_FACTORY_TYPES; i++)
g_ptr_array_unref (plugin->factories[i]); g_ptr_array_unref (plugin->factories[i]);
g_slice_free (GstPluginStats, data); g_free (data);
} }
static void static void