Rename XKB_NUM_GROUPS to XKB_MAX_GROUPS This is a more appropriate name now. Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
diff --git a/src/keymap.h b/src/keymap.h
index 9ce61e4..5bc2a13 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -101,7 +101,7 @@
* the size of the xkb_layout_mask_t type (32). This is more than enough
* though.
*/
-#define XKB_NUM_GROUPS 4
+#define XKB_MAX_GROUPS 4
/* Don't allow more modifiers than we can hold in xkb_mod_mask_t. */
#define XKB_MAX_MODS ((xkb_mod_index_t) (sizeof(xkb_mod_mask_t) * 8))
diff --git a/src/xkbcomp/expr.c b/src/xkbcomp/expr.c
index f8f2a52..eb043e1 100644
--- a/src/xkbcomp/expr.c
+++ b/src/xkbcomp/expr.c
@@ -396,9 +396,9 @@ ExprResolveGroup(struct xkb_context *ctx, const ExprDef *expr,
if (!ok)
return false;
- if (result <= 0 || result > XKB_NUM_GROUPS) {
+ if (result <= 0 || result > XKB_MAX_GROUPS) {
log_err(ctx, "Group index %u is out of range (1..%d)\n",
- result, XKB_NUM_GROUPS);
+ result, XKB_MAX_GROUPS);
return false;
}
diff --git a/src/xkbcomp/rules.c b/src/xkbcomp/rules.c
index 4287da8..1653f42 100644
--- a/src/xkbcomp/rules.c
+++ b/src/xkbcomp/rules.c
@@ -559,7 +559,7 @@ extract_layout_index(const char *s, size_t max_len, xkb_layout_index_t *out)
return -1;
if (s[0] != '[' || !isdigit(s[1]) || s[2] != ']')
return -1;
- if (s[1] - '0' < 1 || s[1] - '0' > XKB_NUM_GROUPS)
+ if (s[1] - '0' < 1 || s[1] - '0' > XKB_MAX_GROUPS)
return -1;
/* To zero-based index. */
*out = s[1] - '0' - 1;
diff --git a/src/xkbcomp/symbols.c b/src/xkbcomp/symbols.c
index 32c7855..10efef0 100644
--- a/src/xkbcomp/symbols.c
+++ b/src/xkbcomp/symbols.c
@@ -561,11 +561,11 @@ HandleIncludeSymbols(SymbolsInfo *info, IncludeStmt *stmt)
next_incl.merge = next_incl.dflt.merge = MERGE_OVERRIDE;
if (stmt->modifier) {
next_incl.explicit_group = atoi(stmt->modifier) - 1;
- if (next_incl.explicit_group >= XKB_NUM_GROUPS) {
+ if (next_incl.explicit_group >= XKB_MAX_GROUPS) {
log_err(info->keymap->ctx,
"Cannot set explicit group to %d - must be between 1..%d; "
"Ignoring group number\n",
- next_incl.explicit_group + 1, XKB_NUM_GROUPS);
+ next_incl.explicit_group + 1, XKB_MAX_GROUPS);
next_incl.explicit_group = info->explicit_group;
}
}
@@ -609,11 +609,11 @@ GetGroupIndex(SymbolsInfo *info, KeyInfo *keyi, ExprDef *arrayNdx,
}
}
- if (i >= XKB_NUM_GROUPS) {
+ if (i >= XKB_MAX_GROUPS) {
log_err(info->keymap->ctx,
"Too many groups of %s for key %s (max %u); "
"Ignoring %s defined for extra groups\n",
- name, KeyInfoText(info, keyi), XKB_NUM_GROUPS + 1, name);
+ name, KeyInfoText(info, keyi), XKB_MAX_GROUPS, name);
return false;
}