xkbcomp: remove useless function XkbChooseMap
authorRan Benita <ran234@gmail.com>
Fri, 29 Jun 2012 16:26:01 +0000 (19:26 +0300)
committerRan Benita <ran234@gmail.com>
Sat, 30 Jun 2012 21:51:56 +0000 (00:51 +0300)
compile_keymap can only be passes a single keymap file now, from all
code paths leading to it. So this function doesn't do anything.

The remaining check is performed inside CompileKeymap, so we can remove
it as well; compile_keymap doesn't do much now.

Signed-off-by: Ran Benita <ran234@gmail.com>
src/xkbcomp/xkbcomp.c

index e7f5050..63d5fe3 100644 (file)
@@ -96,61 +96,13 @@ xkb_map_new_from_names(struct xkb_context *ctx,
     return keymap;
 }
 
-static XkbFile *
-XkbChooseMap(XkbFile *file, const char *name)
-{
-    XkbFile *map = file;
-
-    /* map specified? */
-    if (name) {
-        while (map) {
-            if (map->name && strcmp(map->name, name) == 0)
-                break;
-            map = (XkbFile *) map->common.next;
-        }
-
-        if (!map)
-            ERROR("no map named \"%s\" in input file\n", name);
-    }
-    else if (file->common.next) {
-        /* look for map with XkbLC_Default flag. */
-        for (; map; map = (XkbFile *) map->common.next) {
-            if (map->flags & XkbLC_Default)
-                break;
-        }
-
-        if (!map) {
-            map = file;
-            WARN("no map specified, but components have several\n");
-            WARN("using the first defined map, \"%s\"\n",
-                 map->name ? map->name : "");
-        }
-    }
-
-    return map;
-}
-
 static struct xkb_keymap *
 compile_keymap(struct xkb_context *ctx, XkbFile *file)
 {
-    XkbFile *mapToUse;
-    struct xkb_keymap *keymap = NULL;
-
-    /* Find map to use */
-    mapToUse = XkbChooseMap(file, NULL);
-    if (!mapToUse)
-        goto err;
-
-    if (mapToUse->type != FILE_TYPE_KEYMAP) {
-        ERROR("file type %d not handled\n", mapToUse->type);
-        goto err;
-    }
+    struct xkb_keymap *keymap;
 
-    keymap = CompileKeymap(ctx, mapToUse);
-    if (!keymap)
-        goto err;
+    keymap = CompileKeymap(ctx, file);
 
-err:
     FreeXKBFile(file);
     return keymap;
 }