From: Lennart Poettering Date: Thu, 18 Oct 2018 17:49:18 +0000 (+0200) Subject: util: drop const_int_one/const_int_zero again X-Git-Tag: v240~515^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F10456%2Fhead;p=thirdparty%2Fsystemd.git util: drop const_int_one/const_int_zero again There's only a single user remaining now that we have setsockopt_int(), let's define those variables locally. This more or less reverts 6d5e65f6454212cd400d0ebda34978a9f20cc26a. --- diff --git a/src/basic/util.c b/src/basic/util.c index c4c66cca53b..0da963f4af8 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -51,9 +51,6 @@ int saved_argc = 0; char **saved_argv = NULL; static int saved_in_initrd = -1; -const int const_int_zero = 0; -const int const_int_one = 1; - size_t page_size(void) { static thread_local size_t pgsz = 0; long r; diff --git a/src/basic/util.h b/src/basic/util.h index 32d9380bd96..8cba4ed7260 100644 --- a/src/basic/util.h +++ b/src/basic/util.h @@ -232,6 +232,3 @@ int version(void); int str_verscmp(const char *s1, const char *s2); void disable_coredumps(void); - -extern const int const_int_zero; -extern const int const_int_one; diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index 752e17f2aed..7ffaf159203 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -1392,12 +1392,14 @@ static void add_rule(struct udev_rules *rules, char *line, rule_add_key(&rule_tmp, TK_A_DB_PERSIST, op, NULL, NULL); pos = strstr(value, "nowatch"); - if (pos) - rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, op, NULL, &const_int_zero); - else { + if (pos) { + static const int zero = 0; + rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, op, NULL, &zero); + } else { + static const int one = 1; pos = strstr(value, "watch"); if (pos) - rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, op, NULL, &const_int_one); + rule_add_key(&rule_tmp, TK_A_INOTIFY_WATCH, op, NULL, &one); } pos = strstr(value, "static_node=");