From 2f4cefe6ce00a38988830e88f7b16acfb6b21b3c Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 22 Mar 2018 16:59:46 +0100 Subject: [PATCH] sleep-config: replace USE() macro with TAKE_PTR() usage let's use the new generic macor instead of the locally defined, specific one. --- src/shared/sleep-config.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c index 1e1a7e5..f65eed8 100644 --- a/src/shared/sleep-config.c +++ b/src/shared/sleep-config.c @@ -40,8 +40,6 @@ #include "string-util.h" #include "strv.h" -#define USE(x, y) do { (x) = (y); (y) = NULL; } while (0) - int parse_sleep_config(const char *verb, char ***_modes, char ***_states, usec_t *_delay) { _cleanup_strv_free_ char @@ -69,32 +67,32 @@ int parse_sleep_config(const char *verb, char ***_modes, char ***_states, usec_t if (streq(verb, "suspend")) { /* empty by default */ - USE(modes, suspend_mode); + modes = TAKE_PTR(suspend_mode); if (suspend_state) - USE(states, suspend_state); + states = TAKE_PTR(suspend_state); else states = strv_new("mem", "standby", "freeze", NULL); } else if (streq(verb, "hibernate")) { if (hibernate_mode) - USE(modes, hibernate_mode); + modes = TAKE_PTR(hibernate_mode); else modes = strv_new("platform", "shutdown", NULL); if (hibernate_state) - USE(states, hibernate_state); + states = TAKE_PTR(hibernate_state); else states = strv_new("disk", NULL); } else if (streq(verb, "hybrid-sleep")) { if (hybrid_mode) - USE(modes, hybrid_mode); + modes = TAKE_PTR(hybrid_mode); else modes = strv_new("suspend", "platform", "shutdown", NULL); if (hybrid_state) - USE(states, hybrid_state); + states = TAKE_PTR(hybrid_state); else states = strv_new("disk", NULL); -- 2.7.4