gst-docs: drop use of GSlice in example code

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3784>
This commit is contained in:
Tim-Philipp Müller 2023-01-24 21:08:12 +00:00 committed by GStreamer Marge Bot
parent 18a3c32323
commit 0d9bdf238c
2 changed files with 5 additions and 5 deletions

View file

@ -36,7 +36,7 @@ provided to the `gst_mini_object_init()` function.
MyObject *
my_object_new()
{
MyObject *res = g_slice_new (MyObject);
MyObject *res = g_new (MyObject, 1);
gst_mini_object_init (GST_MINI_OBJECT_CAST (res), 0,
MY_TYPE_OBJECT,
@ -61,7 +61,7 @@ _my_object_free (MyObject *obj)
/* other cleanup */
...
g_slice_free (MyObject, obj);
g_free (obj);
}
```

View file

@ -128,7 +128,7 @@ default_push (GstTaskPool * pool, GstTaskPoolFunction func, gpointer data,
pthread_attr_t attr;
struct sched_param param;
tid = g_slice_new0 (TestRTId);
tid = g_new0 (TestRTId, 1);
pthread_attr_init (&attr);
if ((res = pthread_attr_setschedpolicy (&attr, SCHED_RR)) != 0)
@ -146,7 +146,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;
}
@ -160,7 +160,7 @@ default_join (GstTaskPool * pool, gpointer id)
pthread_join (tid->thread, NULL);
g_slice_free (TestRTId, tid);
g_free (tid);
}
static void