From 0d9bdf238cde79606b03502f944580a11c536eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 24 Jan 2023 21:08:12 +0000 Subject: [PATCH] gst-docs: drop use of GSlice in example code Part-of: --- .../gst-docs/markdown/additional/design/miniobject.md | 4 ++-- .../markdown/application-development/advanced/threads.md | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/subprojects/gst-docs/markdown/additional/design/miniobject.md b/subprojects/gst-docs/markdown/additional/design/miniobject.md index e7037cfe74..a3dca27721 100644 --- a/subprojects/gst-docs/markdown/additional/design/miniobject.md +++ b/subprojects/gst-docs/markdown/additional/design/miniobject.md @@ -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); } ``` diff --git a/subprojects/gst-docs/markdown/application-development/advanced/threads.md b/subprojects/gst-docs/markdown/application-development/advanced/threads.md index 79c065debc..9d81346061 100644 --- a/subprojects/gst-docs/markdown/application-development/advanced/threads.md +++ b/subprojects/gst-docs/markdown/application-development/advanced/threads.md @@ -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