Use do-while(0) statement for the macro checking argument 89/236789/1
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 22 Jun 2020 05:39:59 +0000 (14:39 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 22 Jun 2020 05:41:14 +0000 (14:41 +0900)
[Version] 0.6.9
[Issue Type] Improvement

Change-Id: If56b0d4839c3b7cec70f136281406bdd0cabd1d7
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/sound_manager_private.h
packaging/capi-media-sound-manager.spec
src/sound_manager_private.c

index 1772cc0911344b4a1ded1fb6e3e764215e03e3c3..e772db5f7c99c19eb1d863f5df12c4100ce1494d 100644 (file)
@@ -42,11 +42,12 @@ extern "C"
 #include "sound_manager_internal.h"
 
 #define _CHECK_CONDITION(condition, error, msg)     \
-if (condition) { \
-} else { \
-       LOGE("[%s] %s(0x%08x)", __FUNCTION__, msg, error); \
-       return error; \
-}; \
+do { \
+       if (!(condition)) { \
+               LOGE("[%s] %s(0x%08x)", __FUNCTION__, msg, error); \
+               return error; \
+       } \
+} while (0)
 
 #define SM_INSTANCE_CHECK(handle) \
 _CHECK_CONDITION(handle != NULL, SOUND_MANAGER_ERROR_INVALID_PARAMETER, "SOUND_MANAGER_ERROR_INVALID_PARAMETER")
index 944764eb734deeae2d76e38c2fff4315ec276cb6..0f203daa22f0e8dcde4ff0e9609c92c8f101a077 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.6.8
+Version:    0.6.9
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 35544aca41694138810a6afa96fa77539fdfb8d2..0e0458d8d31ae3988a64e7af64c2725b194cf858 100644 (file)
@@ -3336,7 +3336,7 @@ int _get_latest_stream_pid(int stream_type, unsigned int *pid)
        const gchar *dbus_ret = NULL;
        unsigned int _pid;
 
-       SM_NULL_ARG_CHECK_FOR_PRIV(pid)
+       SM_NULL_ARG_CHECK_FOR_PRIV(pid);
 
        if ((ret = __get_dbus_connection(&conn)))
                return ret;