core: examples: 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-06 01:37:39 +00:00 committed by GStreamer Marge Bot
parent d5d25c0f7a
commit 28dc56dc6c
3 changed files with 9 additions and 9 deletions

View file

@ -36,7 +36,7 @@ _my_alloc (GstAllocator * allocator, gsize size, GstAllocationParams * params)
GST_DEBUG ("alloc from allocator %p", allocator);
mem = g_slice_new (MyMemory);
mem = g_new (MyMemory, 1);
gst_memory_init (GST_MEMORY_CAST (mem), params->flags, allocator, NULL,
maxsize, params->align, params->prefix, size);
@ -52,7 +52,7 @@ _my_free (GstAllocator * allocator, GstMemory * mem)
MyMemory *mmem = (MyMemory *) mem;
g_free (mmem->data);
g_slice_free (MyMemory, mmem);
g_free (mmem);
GST_DEBUG ("%p: freed", mmem);
}
@ -101,7 +101,7 @@ _my_mem_share (MyMemory * mem, gssize offset, gsize size)
if (size == -1)
size = mem->mem.size - offset;
sub = g_slice_new (MyMemory);
sub = g_new (MyMemory, 1);
/* the shared memory is always readonly */
gst_memory_init (GST_MEMORY_CAST (sub), GST_MINI_OBJECT_FLAGS (parent) |
GST_MINI_OBJECT_FLAG_LOCK_READONLY, mem->mem.allocator, parent,

View file

@ -47,7 +47,7 @@ _my_free (GstAllocator * allocator, GstMemory * mem)
MyVidmem *vmem = (MyVidmem *) mem;
g_free (vmem->data);
g_slice_free (MyVidmem, vmem);
g_free (vmem);
GST_DEBUG ("%p: freed", vmem);
}
@ -96,7 +96,7 @@ _my_vidmem_share (MyVidmem * mem, gssize offset, gsize size)
if (size == -1)
size = mem->mem.size - offset;
sub = g_slice_new (MyVidmem);
sub = g_new (MyVidmem, 1);
/* the shared memory is always readonly */
gst_memory_init (GST_MEMORY_CAST (sub), GST_MINI_OBJECT_FLAGS (parent) |
GST_MINI_OBJECT_FLAG_LOCK_READONLY, mem->mem.allocator, parent,
@ -161,7 +161,7 @@ my_vidmem_alloc (guint format, guint width, guint height)
maxsize = (GST_ROUND_UP_4 (width) * height);
mem = g_slice_new (MyVidmem);
mem = g_new (MyVidmem, 1);
gst_memory_init (GST_MEMORY_CAST (mem), 0, _my_allocator, NULL,
maxsize, 31, 0, maxsize);

View file

@ -55,7 +55,7 @@ default_push (GstTaskPool * pool, GstTaskPoolFunction func, gpointer data,
g_message ("pushing Realtime pool %p, %p", pool, func);
tid = g_slice_new0 (TestRTId);
tid = g_new0 (TestRTId, 1);
g_message ("set policy");
pthread_attr_init (&attr);
@ -77,7 +77,7 @@ default_push (GstTaskPool * pool, GstTaskPoolFunction func, gpointer data,
if (res != 0) {
g_set_error (error, G_THREAD_ERROR, G_THREAD_ERROR_AGAIN,
"Error creating thread: %s", g_strerror (res));
g_slice_free (TestRTId, tid);
g_free (tid);
tid = NULL;
}
@ -93,7 +93,7 @@ default_join (GstTaskPool * pool, gpointer id)
pthread_join (tid->thread, NULL);
g_slice_free (TestRTId, tid);
g_free (tid);
}
static void