summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-03-22 16:59:46 +0100
committerLennart Poettering <lennart@poettering.net>2018-03-22 20:21:42 +0100
commit2f4cefe6ce00a38988830e88f7b16acfb6b21b3c (patch)
tree6c330b97c3781b3f23b88a5e10484c60e0d94ee1
parentae2a15bc14bc448e625ad93fd044bc077ede4b3f (diff)
downloadsystemd-2f4cefe6ce00a38988830e88f7b16acfb6b21b3c.tar.gz
sleep-config: replace USE() macro with TAKE_PTR() usage
let's use the new generic macor instead of the locally defined, specific one.
-rw-r--r--src/shared/sleep-config.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/shared/sleep-config.c b/src/shared/sleep-config.c
index 1e1a7e57ad..f65eed87f2 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);