plugin-api: deviced: Replace macro MATCH() with strncmp() 80/297580/1
authorYoungjae Cho <y0.cho@samsung.com>
Mon, 21 Aug 2023 08:28:47 +0000 (17:28 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Mon, 21 Aug 2023 08:33:53 +0000 (17:33 +0900)
The macro MATCH() has come from the deviced, and has been working
well as it is, currently, always built with that macro definition
within the deviced. Fix it not to be associated with the deviced
so that it is able to be built alone.

Change-Id: I21fe6f33f14ad6037592af12c6e1404f8ef128d1
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/plugin-api/deviced/include/syscommon-plugin-deviced-power-interface.h

index 71f0b89..c28b7e8 100644 (file)
@@ -25,6 +25,8 @@
 #ifndef __SYSCOMMON_PLUGIN_DEVICED_POWER_INTERFACE_H__
 #define __SYSCOMMON_PLUGIN_DEVICED_POWER_INTERFACE_H__
 
+#include <string.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -82,19 +84,19 @@ struct syscommon_plugin_deviced_power_trans_info {
 
 static inline u_int64_t syscommon_plugin_deviced_power_convert_to_power_state(const char *str)
 {
-       if (MATCH(str, "start"))
+       if (strncmp(str, "start", sizeof("start")) == 0)
                return DEVICED_POWER_STATE_START;
-       else if (MATCH(str, "sleep"))
+       else if (strncmp(str, "sleep", sizeof("sleep")) == 0)
                return DEVICED_POWER_STATE_SLEEP;
-       else if (MATCH(str, "normal"))
+       else if (strncmp(str, "normal", sizeof("normal")) == 0)
                return DEVICED_POWER_STATE_NORMAL;
-       else if (MATCH(str, "poweroff"))
+       else if (strncmp(str, "poweroff", sizeof("poweroff")) == 0)
                return DEVICED_POWER_STATE_POWEROFF;
-       else if (MATCH(str, "reboot"))
+       else if (strncmp(str, "reboot", sizeof("reboot")) == 0)
                return DEVICED_POWER_STATE_REBOOT;
-       else if (MATCH(str, "exit"))
+       else if (strncmp(str, "exit", sizeof("exit")) == 0)
                return DEVICED_POWER_STATE_EXIT;
-       else if (MATCH(str, "current"))
+       else if (strncmp(str, "current", sizeof("current")) == 0)
                return DEVICED_POWER_STATE_ALL;
 
        return DEVICED_POWER_STATE_UNDEFINED;