1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-11 09:18:07 +03:00

locale: move x11_convert_to_vconsole() near the relevant functions

No functional changes, just refactoring.
This commit is contained in:
Yu Watanabe 2023-02-02 01:34:24 +09:00
parent 363ed18730
commit 3017b9b1a6

View File

@ -755,6 +755,30 @@ int find_legacy_keymap(const X11Context *xc, char **ret) {
return !!*ret;
}
int x11_convert_to_vconsole(const X11Context *xc, VCContext *ret) {
_cleanup_free_ char *keymap = NULL;
int r;
assert(xc);
assert(ret);
if (isempty(xc->layout)) {
*ret = (VCContext) {};
return 0;
}
r = find_converted_keymap(xc, &keymap);
if (r == 0)
r = find_legacy_keymap(xc, &keymap);
if (r < 0)
return r;
*ret = (VCContext) {
.keymap = TAKE_PTR(keymap),
};
return 0;
}
int find_language_fallback(const char *lang, char **ret) {
const char *map;
_cleanup_fclose_ FILE *f = NULL;
@ -784,30 +808,6 @@ int find_language_fallback(const char *lang, char **ret) {
}
}
int x11_convert_to_vconsole(const X11Context *xc, VCContext *ret) {
_cleanup_free_ char *keymap = NULL;
int r;
assert(xc);
assert(ret);
if (isempty(xc->layout)) {
*ret = (VCContext) {};
return 0;
}
r = find_converted_keymap(xc, &keymap);
if (r == 0)
r = find_legacy_keymap(xc, &keymap);
if (r < 0)
return r;
*ret = (VCContext) {
.keymap = TAKE_PTR(keymap),
};
return 0;
}
bool locale_gen_check_available(void) {
#if HAVE_LOCALEGEN
if (access(LOCALEGEN_PATH, X_OK) < 0) {