From: backto.kim Date: Tue, 19 Oct 2021 07:05:45 +0000 (+0900) Subject: define SAFE_G_LIST_FREE_FULL() X-Git-Tag: submit/tizen/20211020.012736~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b3d0a0f37642f8e5c683620341ce7f176d2da510;p=platform%2Fcore%2Fapi%2Fwebrtc.git define SAFE_G_LIST_FREE_FULL() [Version] 0.2.129 [Issue Type] Refactoring Change-Id: I05c1c0953d74427faa01b5be108439723f68d8af --- diff --git a/include/webrtc_private.h b/include/webrtc_private.h index 54a3f1ac..d1ef4a1d 100644 --- a/include/webrtc_private.h +++ b/include/webrtc_private.h @@ -152,6 +152,7 @@ do { \ #define SAFE_GST_OBJECT_UNREF(src) { if (src) { gst_object_unref(src); src = NULL; } } #define SAFE_G_LIST_FREE(src) { if (src) { g_list_free(src); src = NULL; } } #define SAFE_STR(str) (str) ? str : "null" +#define SAFE_G_LIST_FREE_FULL(src, free_func) { if (src) { g_list_free_full(src, free_func); src = NULL; } } #define PRINT_CAPS(x_caps, x_prefix) \ do { \ diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index cb0799fe..f9da3328 100644 --- a/packaging/capi-media-webrtc.spec +++ b/packaging/capi-media-webrtc.spec @@ -1,6 +1,6 @@ Name: capi-media-webrtc Summary: A WebRTC library in Tizen Native API -Version: 0.2.128 +Version: 0.2.129 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_source.c b/src/webrtc_source.c index ad6d459b..ddde78f0 100644 --- a/src/webrtc_source.c +++ b/src/webrtc_source.c @@ -1174,17 +1174,6 @@ static bool __remove_elements_from_bin(GstBin *bin, GList *element_list) return true; } -static void __unref_elements(GList *element_list) -{ - GList *list; - - if (!element_list) - return; - - for (list = element_list; list; list = g_list_next(list)) - SAFE_GST_OBJECT_UNREF(list->data); -} - static bool __link_elements(GList *element_list) { GstElement *curr; @@ -1358,10 +1347,8 @@ exit_with_remove_from_bin: SAFE_G_LIST_FREE(element_list); return ret; exit: - __unref_elements(switch_src_list); - __unref_elements(element_list); - SAFE_G_LIST_FREE(switch_src_list); - SAFE_G_LIST_FREE(element_list); + SAFE_G_LIST_FREE_FULL(switch_src_list, gst_object_unref); + SAFE_G_LIST_FREE_FULL(element_list, gst_object_unref); return ret; } @@ -1428,8 +1415,7 @@ exit_with_remove_from_bin: SAFE_G_LIST_FREE(element_list); return ret; exit: - __unref_elements(element_list); - SAFE_G_LIST_FREE(element_list); + SAFE_G_LIST_FREE_FULL(element_list, gst_object_unref); return ret; } @@ -1496,8 +1482,7 @@ exit_with_remove_from_bin: SAFE_G_LIST_FREE(element_list); return ret; exit: - __unref_elements(element_list); - SAFE_G_LIST_FREE(element_list); + SAFE_G_LIST_FREE_FULL(element_list, gst_object_unref); return ret; } @@ -1559,8 +1544,7 @@ exit_with_remove_from_bin: SAFE_G_LIST_FREE(element_list); return ret; exit: - __unref_elements(element_list); - SAFE_G_LIST_FREE(element_list); + SAFE_G_LIST_FREE_FULL(element_list, gst_object_unref); return ret; } @@ -1617,8 +1601,7 @@ exit_with_remove_from_bin: SAFE_G_LIST_FREE(element_list); return ret; exit: - __unref_elements(element_list); - SAFE_G_LIST_FREE(element_list); + SAFE_G_LIST_FREE_FULL(element_list, gst_object_unref); return ret; } @@ -1682,8 +1665,7 @@ exit_with_remove_from_bin: SAFE_G_LIST_FREE(element_list); return ret; exit: - __unref_elements(element_list); - SAFE_G_LIST_FREE(element_list); + SAFE_G_LIST_FREE_FULL(element_list, gst_object_unref); return ret; } @@ -1747,8 +1729,7 @@ exit_with_remove_from_bin: SAFE_G_LIST_FREE(element_list); return WEBRTC_ERROR_INVALID_OPERATION; exit: - __unref_elements(element_list); - SAFE_G_LIST_FREE(element_list); + SAFE_G_LIST_FREE_FULL(element_list, gst_object_unref); return WEBRTC_ERROR_INVALID_OPERATION; } @@ -1947,8 +1928,7 @@ exit_with_remove_from_bin: SAFE_G_LIST_FREE(element_list); return WEBRTC_ERROR_INVALID_OPERATION; exit: - __unref_elements(element_list); - SAFE_G_LIST_FREE(element_list); + SAFE_G_LIST_FREE_FULL(element_list, gst_object_unref); return WEBRTC_ERROR_INVALID_OPERATION; } @@ -2322,8 +2302,7 @@ exit_with_remove_from_bin: SAFE_G_LIST_FREE(element_list); return ret; exit: - __unref_elements(element_list); - SAFE_G_LIST_FREE(element_list); + SAFE_G_LIST_FREE_FULL(element_list, gst_object_unref); return ret; }