Handle XkbFiles without a name

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
master
Daniel Stone 2012-03-10 13:54:03 +00:00
parent c8fd3ea4b6
commit 671ab1bf8f
1 changed files with 6 additions and 6 deletions

View File

@ -60,7 +60,7 @@ CompileKeymap(XkbFile *file, unsigned merge)
memset(&sections, 0, sizeof(sections));
mainType = file->type;
mainName = file->name;
mainName = file->name ? file->name : "(unnamed)";
switch (mainType)
{
case XkmSemanticsFile:
@ -86,11 +86,6 @@ CompileKeymap(XkbFile *file, unsigned merge)
/* Check for duplicate entries in the input file */
for (file = (XkbFile *) file->defs; file; file = (XkbFile *) file->common.next)
{
if (file->topName != mainName) {
free(file->topName);
file->topName = strdup(mainName);
}
if ((have & (1 << file->type)) != 0)
{
ERROR("More than one %s section in a %s file\n",
@ -139,6 +134,11 @@ CompileKeymap(XkbFile *file, unsigned merge)
continue;
}
if (!file->topName || strcmp(file->topName, mainName) != 0) {
free(file->topName);
file->topName = strdup(mainName);
}
have |= (1 << file->type);
}