webrtc_private: Revise macro definitions 60/265460/2
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 20 Oct 2021 02:34:18 +0000 (11:34 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 20 Oct 2021 04:47:18 +0000 (13:47 +0900)
Some are modified to use do/while(0).

[Version] 0.2.134
[Issue Type] Improvement

Change-Id: Iae3b8aa519077fd03593651b3478deb7f2397e57
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/webrtc_private.h
packaging/capi-media-webrtc.spec

index 45a1055b6f97f873d5ad03e7f11dd1606a290d57..37da9ce4140c7d32ed5126e8ac78ee8e0cd48905 100644 (file)
@@ -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); \
index 3c27a2777d59c16c45ff63b6922385d32ce7feb6..8e9b29afae278edd9c36541a565934f9648a9c12 100644 (file)
@@ -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