darray: cleanup
[platform/upstream/libxkbcommon.git] / src / keymap-priv.c
index 9f42040..2b3f8cd 100644 (file)
@@ -30,12 +30,7 @@ static void
 update_builtin_keymap_fields(struct xkb_keymap *keymap)
 {
     struct xkb_context *ctx = keymap->ctx;
-
-    /*
-     * Add predefined (AKA real, core, X11) modifiers.
-     * The order is important!
-     */
-    darray_appends_t(keymap->mods, struct xkb_mod,
+    const struct xkb_mod builtin_mods[] = {
         { .name = xkb_atom_intern_literal(ctx, "Shift"),   .type = MOD_REAL },
         { .name = xkb_atom_intern_literal(ctx, "Lock"),    .type = MOD_REAL },
         { .name = xkb_atom_intern_literal(ctx, "Control"), .type = MOD_REAL },
@@ -43,7 +38,14 @@ update_builtin_keymap_fields(struct xkb_keymap *keymap)
         { .name = xkb_atom_intern_literal(ctx, "Mod2"),    .type = MOD_REAL },
         { .name = xkb_atom_intern_literal(ctx, "Mod3"),    .type = MOD_REAL },
         { .name = xkb_atom_intern_literal(ctx, "Mod4"),    .type = MOD_REAL },
-        { .name = xkb_atom_intern_literal(ctx, "Mod5"),    .type = MOD_REAL });
+        { .name = xkb_atom_intern_literal(ctx, "Mod5"),    .type = MOD_REAL },
+    };
+
+    /*
+     * Add predefined (AKA real, core, X11) modifiers.
+     * The order is important!
+     */
+    darray_append_items(keymap->mods, builtin_mods, ARRAY_SIZE(builtin_mods));
 }
 
 struct xkb_keymap *