enum xkb_compose_compile_flags flags)
{
struct xkb_compose_table *table;
- char *path = NULL;
- const char *cpath;
+ char *path;
FILE *file;
bool ok;
if (!table)
return NULL;
- cpath = get_xcomposefile_path();
- if (cpath) {
- file = fopen(cpath, "rb");
+ path = get_xcomposefile_path();
+ if (path) {
+ file = fopen(path, "rb");
if (file)
goto found_path;
}
+ free(path);
- cpath = path = get_xdg_xcompose_file_path();
+ path = get_xdg_xcompose_file_path();
if (path) {
file = fopen(path, "rb");
if (file)
goto found_path;
}
free(path);
- path = NULL;
- cpath = path = get_home_xcompose_file_path();
+ path = get_home_xcompose_file_path();
if (path) {
file = fopen(path, "rb");
if (file)
goto found_path;
}
free(path);
- path = NULL;
- cpath = path = get_locale_compose_file_path(table->locale);
+ path = get_locale_compose_file_path(table->locale);
if (path) {
file = fopen(path, "rb");
if (file)
goto found_path;
}
free(path);
- path = NULL;
log_err(ctx, "couldn't find a Compose file for locale \"%s\"\n", locale);
xkb_compose_table_unref(table);
return NULL;
found_path:
- ok = parse_file(table, file, cpath);
+ ok = parse_file(table, file, path);
fclose(file);
if (!ok) {
+ free(path);
xkb_compose_table_unref(table);
return NULL;
}