From: Youngjae Cho Date: Mon, 21 Aug 2023 08:28:47 +0000 (+0900) Subject: plugin-api: deviced: Replace macro MATCH() with strncmp() X-Git-Tag: accepted/tizen/unified/20230823.021351~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=719d8031b7fc53d089557783270eaa6c9663b765;p=platform%2Fcore%2Fsystem%2Flibsyscommon.git plugin-api: deviced: Replace macro MATCH() with strncmp() 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 --- diff --git a/src/plugin-api/deviced/include/syscommon-plugin-deviced-power-interface.h b/src/plugin-api/deviced/include/syscommon-plugin-deviced-power-interface.h index 71f0b89..c28b7e8 100644 --- a/src/plugin-api/deviced/include/syscommon-plugin-deviced-power-interface.h +++ b/src/plugin-api/deviced/include/syscommon-plugin-deviced-power-interface.h @@ -25,6 +25,8 @@ #ifndef __SYSCOMMON_PLUGIN_DEVICED_POWER_INTERFACE_H__ #define __SYSCOMMON_PLUGIN_DEVICED_POWER_INTERFACE_H__ +#include + #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;