return SYSTEMD_LANGUAGE_FALLBACK_MAP;
}
-static void context_free_x11(Context *c) {
+static void context_clear_x11(Context *c) {
assert(c);
c->x11_layout = mfree(c->x11_layout);
c->x11_variant = mfree(c->x11_variant);
}
-static void context_free_vconsole(Context *c) {
+static void context_clear_vconsole(Context *c) {
assert(c);
c->vc_keymap = mfree(c->vc_keymap);
assert(c);
locale_context_clear(&c->locale_context);
- context_free_x11(c);
- context_free_vconsole(c);
+ context_clear_x11(c);
+ context_clear_vconsole(c);
- sd_bus_message_unref(c->locale_cache);
- sd_bus_message_unref(c->x11_cache);
- sd_bus_message_unref(c->vc_cache);
+ c->locale_cache = sd_bus_message_unref(c->locale_cache);
+ c->x11_cache = sd_bus_message_unref(c->x11_cache);
+ c->vc_cache = sd_bus_message_unref(c->vc_cache);
- bus_verify_polkit_async_registry_free(c->polkit_registry);
+ c->polkit_registry = bus_verify_polkit_async_registry_free(c->polkit_registry);
};
int locale_read_data(Context *c, sd_bus_message *m) {
fd = RET_NERRNO(open("/etc/vconsole.conf", O_CLOEXEC | O_PATH));
if (fd == -ENOENT) {
c->vc_stat = (struct stat) {};
- context_free_vconsole(c);
+ context_clear_vconsole(c);
return 0;
}
if (fd < 0)
return 0;
c->vc_stat = st;
- context_free_vconsole(c);
+ context_clear_vconsole(c);
return parse_env_file_fd(fd, "/etc/vconsole.conf",
"KEYMAP", &c->vc_keymap,
fd = RET_NERRNO(open("/etc/X11/xorg.conf.d/00-keyboard.conf", O_CLOEXEC | O_PATH));
if (fd == -ENOENT) {
c->x11_stat = (struct stat) {};
- context_free_x11(c);
+ context_clear_x11(c);
return 0;
}
if (fd < 0)
return 0;
c->x11_stat = st;
- context_free_x11(c);
+ context_clear_x11(c);
fd_ro = fd_reopen(fd, O_CLOEXEC | O_RDONLY);
if (fd_ro < 0)
!isempty(c->x11_variant) ||
!isempty(c->x11_options);
- context_free_x11(c);
+ context_clear_x11(c);
} else {
_cleanup_fclose_ FILE *f = NULL;
const char *map;
!isempty(c->vc_keymap) ||
!isempty(c->vc_keymap_toggle);
- context_free_vconsole(c);
+ context_clear_vconsole(c);
} else {
_cleanup_free_ char *new_keymap = NULL;
int r;
log_notice("No conversion to virtual console map found for \"%s\".", c->x11_layout);
if (!streq_ptr(c->vc_keymap, new_keymap)) {
- free_and_replace(c->vc_keymap, new_keymap);
- c->vc_keymap_toggle = mfree(c->vc_keymap_toggle);
+ context_clear_vconsole(c);
+ c->vc_keymap = TAKE_PTR(new_keymap);
modified = true;
}
}