libs: base: 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:30:36 +00:00 committed by GStreamer Marge Bot
parent 1919030363
commit 78149326c9
6 changed files with 15 additions and 15 deletions

View file

@ -63,7 +63,7 @@
GstBitReader * GstBitReader *
gst_bit_reader_new (const guint8 * data, guint size) gst_bit_reader_new (const guint8 * data, guint size)
{ {
GstBitReader *ret = g_slice_new0 (GstBitReader); GstBitReader *ret = g_new0 (GstBitReader, 1);
ret->data = data; ret->data = data;
ret->size = size; ret->size = size;
@ -83,7 +83,7 @@ gst_bit_reader_free (GstBitReader * reader)
{ {
g_return_if_fail (reader != NULL); g_return_if_fail (reader != NULL);
g_slice_free (GstBitReader, reader); g_free (reader);
} }
/** /**

View file

@ -99,7 +99,7 @@
GstByteReader * GstByteReader *
gst_byte_reader_new (const guint8 * data, guint size) gst_byte_reader_new (const guint8 * data, guint size)
{ {
GstByteReader *ret = g_slice_new0 (GstByteReader); GstByteReader *ret = g_new0 (GstByteReader, 1);
ret->data = data; ret->data = data;
ret->size = size; ret->size = size;
@ -119,7 +119,7 @@ gst_byte_reader_free (GstByteReader * reader)
{ {
g_return_if_fail (reader != NULL); g_return_if_fail (reader != NULL);
g_slice_free (GstByteReader, reader); g_free (reader);
} }
/** /**

View file

@ -78,7 +78,7 @@
GstByteWriter * GstByteWriter *
gst_byte_writer_new (void) gst_byte_writer_new (void)
{ {
GstByteWriter *ret = g_slice_new0 (GstByteWriter); GstByteWriter *ret = g_new0 (GstByteWriter, 1);
ret->owned = TRUE; ret->owned = TRUE;
return ret; return ret;
@ -289,7 +289,7 @@ gst_byte_writer_free (GstByteWriter * writer)
g_return_if_fail (writer != NULL); g_return_if_fail (writer != NULL);
gst_byte_writer_reset (writer); gst_byte_writer_reset (writer);
g_slice_free (GstByteWriter, writer); g_free (writer);
} }
/** /**
@ -311,7 +311,7 @@ gst_byte_writer_free_and_get_data (GstByteWriter * writer)
g_return_val_if_fail (writer != NULL, NULL); g_return_val_if_fail (writer != NULL, NULL);
data = gst_byte_writer_reset_and_get_data (writer); data = gst_byte_writer_reset_and_get_data (writer);
g_slice_free (GstByteWriter, writer); g_free (writer);
return data; return data;
} }
@ -336,7 +336,7 @@ gst_byte_writer_free_and_get_buffer (GstByteWriter * writer)
g_return_val_if_fail (writer != NULL, NULL); g_return_val_if_fail (writer != NULL, NULL);
buffer = gst_byte_writer_reset_and_get_buffer (writer); buffer = gst_byte_writer_reset_and_get_buffer (writer);
g_slice_free (GstByteWriter, writer); g_free (writer);
return buffer; return buffer;
} }

View file

@ -95,7 +95,7 @@ G_DEFINE_BOXED_TYPE_WITH_CODE (GstFlowCombiner, gst_flow_combiner,
GstFlowCombiner * GstFlowCombiner *
gst_flow_combiner_new (void) gst_flow_combiner_new (void)
{ {
GstFlowCombiner *combiner = g_slice_new (GstFlowCombiner); GstFlowCombiner *combiner = g_new (GstFlowCombiner, 1);
g_queue_init (&combiner->pads); g_queue_init (&combiner->pads);
combiner->last_ret = GST_FLOW_OK; combiner->last_ret = GST_FLOW_OK;
@ -161,7 +161,7 @@ gst_flow_combiner_unref (GstFlowCombiner * combiner)
while ((pad = g_queue_pop_head (&combiner->pads))) while ((pad = g_queue_pop_head (&combiner->pads)))
gst_object_unref (pad); gst_object_unref (pad);
g_slice_free (GstFlowCombiner, combiner); g_free (combiner);
} }
} }

View file

@ -69,7 +69,7 @@ gst_queue_array_new_for_struct (gsize struct_size, guint initial_size)
g_return_val_if_fail (struct_size > 0, NULL); g_return_val_if_fail (struct_size > 0, NULL);
array = g_slice_new (GstQueueArray); array = g_new (GstQueueArray, 1);
array->elt_size = struct_size; array->elt_size = struct_size;
array->size = initial_size; array->size = initial_size;
array->array = g_malloc0 (struct_size * initial_size); array->array = g_malloc0 (struct_size * initial_size);
@ -116,7 +116,7 @@ gst_queue_array_free (GstQueueArray * array)
g_return_if_fail (array != NULL); g_return_if_fail (array != NULL);
gst_queue_array_clear (array); gst_queue_array_clear (array);
g_free (array->array); g_free (array->array);
g_slice_free (GstQueueArray, array); g_free (array);
} }
/** /**

View file

@ -181,7 +181,7 @@ helper_find_peek (gpointer data, gint64 offset, guint size)
return NULL; return NULL;
} }
bmap = g_slice_new0 (GstMappedBuffer); bmap = g_new0 (GstMappedBuffer, 1);
if (!gst_buffer_map (buffer, &bmap->map, GST_MAP_READ)) if (!gst_buffer_map (buffer, &bmap->map, GST_MAP_READ))
goto map_failed; goto map_failed;
@ -210,7 +210,7 @@ map_failed:
{ {
GST_ERROR ("map failed"); GST_ERROR ("map failed");
gst_buffer_unref (buffer); gst_buffer_unref (buffer);
g_slice_free (GstMappedBuffer, bmap); g_free (bmap);
return NULL; return NULL;
} }
} }
@ -436,7 +436,7 @@ gst_type_find_helper_get_range_full (GstObject * obj, GstObject * parent,
gst_buffer_unmap (bmap->buffer, &bmap->map); gst_buffer_unmap (bmap->buffer, &bmap->map);
gst_buffer_unref (bmap->buffer); gst_buffer_unref (bmap->buffer);
g_slice_free (GstMappedBuffer, bmap); g_free (bmap);
} }
g_slist_free (helper.buffers); g_slist_free (helper.buffers);