diff options
Diffstat (limited to 'src/locale')
-rw-r--r-- | src/locale/keymap-util.c | 30 | ||||
-rw-r--r-- | src/locale/localectl.c | 4 | ||||
-rw-r--r-- | src/locale/localed.c | 2 | ||||
-rw-r--r-- | src/locale/test-keymap-util.c | 4 |
4 files changed, 20 insertions, 20 deletions
diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c index 6b6b32a591..b8bd181c16 100644 --- a/src/locale/keymap-util.c +++ b/src/locale/keymap-util.c @@ -3,20 +3,23 @@ #include <errno.h> #include <stdio_ext.h> #include <string.h> +#include <sys/stat.h> +#include <sys/types.h> #include <unistd.h> #include "bus-util.h" -#include "def.h" -#include "env-file.h" #include "env-file-label.h" +#include "env-file.h" #include "env-util.h" #include "fd-util.h" #include "fileio-label.h" #include "fileio.h" +#include "kbd-util.h" #include "keymap-util.h" #include "locale-util.h" #include "macro.h" #include "mkdir.h" +#include "nulstr-util.h" #include "string-util.h" #include "strv.h" #include "tmpfile-util.h" @@ -29,10 +32,6 @@ static bool startswith_comma(const char *s, const char *prefix) { return IN_SET(*s, ',', '\0'); } -static const char* strnulldash(const char *s) { - return isempty(s) || streq(s, "-") ? NULL : s; -} - static const char* systemd_kbd_model_map(void) { const char* s; @@ -419,8 +418,7 @@ int x11_write_data(Context *c) { return 0; } - mkdir_p_label("/etc/X11/xorg.conf.d", 0755); - + (void) mkdir_p_label("/etc/X11/xorg.conf.d", 0755); r = fopen_temporary("/etc/X11/xorg.conf.d/00-keyboard.conf", &f, &temp_path); if (r < 0) return r; @@ -549,15 +547,15 @@ int vconsole_convert_to_x11(Context *c) { if (!streq(c->vc_keymap, a[0])) continue; - if (!streq_ptr(c->x11_layout, strnulldash(a[1])) || - !streq_ptr(c->x11_model, strnulldash(a[2])) || - !streq_ptr(c->x11_variant, strnulldash(a[3])) || - !streq_ptr(c->x11_options, strnulldash(a[4]))) { + if (!streq_ptr(c->x11_layout, empty_or_dash_to_null(a[1])) || + !streq_ptr(c->x11_model, empty_or_dash_to_null(a[2])) || + !streq_ptr(c->x11_variant, empty_or_dash_to_null(a[3])) || + !streq_ptr(c->x11_options, empty_or_dash_to_null(a[4]))) { - if (free_and_strdup(&c->x11_layout, strnulldash(a[1])) < 0 || - free_and_strdup(&c->x11_model, strnulldash(a[2])) < 0 || - free_and_strdup(&c->x11_variant, strnulldash(a[3])) < 0 || - free_and_strdup(&c->x11_options, strnulldash(a[4])) < 0) + if (free_and_strdup(&c->x11_layout, empty_or_dash_to_null(a[1])) < 0 || + free_and_strdup(&c->x11_model, empty_or_dash_to_null(a[2])) < 0 || + free_and_strdup(&c->x11_variant, empty_or_dash_to_null(a[3])) < 0 || + free_and_strdup(&c->x11_options, empty_or_dash_to_null(a[4])) < 0) return -ENOMEM; modified = true; diff --git a/src/locale/localectl.c b/src/locale/localectl.c index 69f5667801..c8b195d9a6 100644 --- a/src/locale/localectl.c +++ b/src/locale/localectl.c @@ -11,18 +11,18 @@ #include "bus-error.h" #include "bus-util.h" -#include "def.h" #include "fd-util.h" #include "fileio.h" +#include "kbd-util.h" #include "locale-util.h" #include "main-func.h" +#include "memory-util.h" #include "pager.h" #include "pretty-print.h" #include "proc-cmdline.h" #include "set.h" #include "spawn-polkit-agent.h" #include "strv.h" -#include "util.h" #include "verbs.h" #include "virt.h" diff --git a/src/locale/localed.c b/src/locale/localed.c index f851d35a08..8d0eec96a5 100644 --- a/src/locale/localed.c +++ b/src/locale/localed.c @@ -2,6 +2,8 @@ #include <errno.h> #include <string.h> +#include <sys/stat.h> +#include <sys/types.h> #include <unistd.h> #if HAVE_XKBCOMMON diff --git a/src/locale/test-keymap-util.c b/src/locale/test-keymap-util.c index 2f82891d60..f96f5b07ec 100644 --- a/src/locale/test-keymap-util.c +++ b/src/locale/test-keymap-util.c @@ -4,6 +4,7 @@ #include "keymap-util.h" #include "log.h" #include "string-util.h" +#include "tests.h" static void test_find_language_fallback(void) { _cleanup_free_ char *ans = NULL, *ans2 = NULL; @@ -189,8 +190,7 @@ static void test_x11_convert_to_vconsole(void) { } int main(int argc, char **argv) { - log_set_max_level(LOG_DEBUG); - log_parse_environment(); + test_setup_logging(LOG_DEBUG); test_find_language_fallback(); test_find_converted_keymap(); |