From: Sangchul Lee Date: Wed, 20 Oct 2021 02:34:18 +0000 (+0900) Subject: webrtc_private: Revise macro definitions X-Git-Tag: submit/tizen/20211028.055213~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5f5970278c62e9cc386c426f1651633abbe4f7df;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_private: Revise macro definitions Some are modified to use do/while(0). [Version] 0.2.134 [Issue Type] Improvement Change-Id: Iae3b8aa519077fd03593651b3478deb7f2397e57 Signed-off-by: Sangchul Lee --- diff --git a/include/webrtc_private.h b/include/webrtc_private.h index 45a1055b..37da9ce4 100644 --- a/include/webrtc_private.h +++ b/include/webrtc_private.h @@ -120,15 +120,13 @@ do { \ #define RET_ERR_IF_PRIVILEGE_IS_NOT_ALLOWED(x_privilege) \ do { \ int pret = _check_privilege(x_privilege); \ - if (pret != WEBRTC_ERROR_NONE) \ - return pret; \ + if (pret != WEBRTC_ERROR_NONE) return pret; \ } while (0) #define RET_ERR_IF_FEATURE_IS_NOT_SUPPORTED(x_feature) \ do { \ int fret = _check_feature(x_feature); \ - if (fret != WEBRTC_ERROR_NONE) \ - return fret; \ + if (fret != WEBRTC_ERROR_NONE) return fret; \ } while (0) #define _WEBRTC_FEATURE_NETWORK_WIFI "http://tizen.org/feature/network.wifi" @@ -136,28 +134,45 @@ do { \ #define _WEBRTC_FEATURE_NETWORK_ETH "http://tizen.org/feature/network.ethernet" #define RET_ERR_IF_NETWORK_FEATURES_ARE_NOT_SUPPORTED() \ do { \ - int fret = _check_feature(_WEBRTC_FEATURE_NETWORK_WIFI); \ - if (fret == WEBRTC_ERROR_NONE) \ - break; \ - fret = _check_feature(_WEBRTC_FEATURE_NETWORK_TELE); \ - if (fret == WEBRTC_ERROR_NONE) \ - break; \ - fret = _check_feature(_WEBRTC_FEATURE_NETWORK_ETH); \ - if (fret == WEBRTC_ERROR_NONE) \ - break; \ + if (_check_feature(_WEBRTC_FEATURE_NETWORK_WIFI) == WEBRTC_ERROR_NONE) break; \ + if (_check_feature(_WEBRTC_FEATURE_NETWORK_TELE) == WEBRTC_ERROR_NONE) break; \ + if (_check_feature(_WEBRTC_FEATURE_NETWORK_ETH) == WEBRTC_ERROR_NONE) break; \ return WEBRTC_ERROR_NOT_SUPPORTED; \ } while (0) -#define SAFE_FREE(src) { if (src) { free(src); src = NULL; } } -#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 SAFE_FREE(src) \ +do { \ + if (!src) break; \ + free(src); \ + src = NULL; \ +} while (0) + +#define SAFE_GST_OBJECT_UNREF(src) \ +do { \ + if (!src) break; \ + gst_object_unref(src); \ + src = NULL; \ +} while (0) + +#define SAFE_G_LIST_FREE(src) \ +do { \ + if (!src) break; \ + g_list_free(src); \ + src = NULL; \ +} while (0) + +#define SAFE_G_LIST_FREE_FULL(src, free_func) \ +do { \ + if (!src) break; \ + g_list_free_full(src, free_func); \ + src = NULL; \ +} while (0) #define PRINT_CAPS(x_caps, x_prefix) \ do { \ - if (!(x_caps)) \ - break; \ + if (!(x_caps)) break; \ gchar *caps_str = gst_caps_to_string(x_caps); \ LOG_INFO("%s caps[%s]", x_prefix, caps_str); \ g_free(caps_str); \ @@ -190,8 +205,7 @@ do { \ #define GENERATE_DOT(x_webrtc, x_pipeline, x_fmt, x_arg...) \ do { \ gchar *dot_name; \ - if (!x_webrtc->ini.general.generate_dot) \ - break; \ + if (!x_webrtc->ini.general.generate_dot) break; \ dot_name = g_strdup_printf(""x_fmt"", x_arg); \ _generate_dot(x_pipeline, dot_name); \ g_free(dot_name); \ diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 3c27a277..8e9b29af 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.133 +Version: 0.2.134 Release: 0 Group: Multimedia/API License: Apache-2.0