remove unused function xkb_canonicalise_components commit 46441b1184dfa8553409d493ae6336aabb900d79 removed this from the public API, and we don't need it internally. So send it to the archives. 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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
diff --git a/Makefile.am b/Makefile.am
index a2fe5ea..3e41ba6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -121,7 +121,6 @@ TESTS = \
test/filecomp \
test/namescomp \
test/rulescomp \
- test/canonicalise \
test/state \
test/context \
test/rules-file \
@@ -134,7 +133,6 @@ test_xkey_LDADD = $(TESTS_LDADD)
test_filecomp_LDADD = $(TESTS_LDADD)
test_namescomp_LDADD = $(TESTS_LDADD)
test_rulescomp_LDADD = $(TESTS_LDADD) -lrt
-test_canonicalise_LDADD = $(TESTS_LDADD)
test_state_LDADD = $(TESTS_LDADD)
test_context_LDADD = $(TESTS_LDADD)
test_rules_file_CFLAGS = $(AM_CFLAGS) -Wno-declaration-after-statement
diff --git a/src/xkb-priv.h b/src/xkb-priv.h
index bfaa300..41dc3c6 100644
--- a/src/xkb-priv.h
+++ b/src/xkb-priv.h
@@ -414,8 +414,6 @@ struct xkb_keymap {
#define XkbKeycodeInRange(d, k) \
(((k) >= (d)->min_key_code) && ((k) <= (d)->max_key_code))
-struct xkb_state;
-
typedef uint32_t xkb_atom_t;
#define XKB_ATOM_NONE 0
@@ -441,24 +439,6 @@ xkb_key_get_syms_by_level(struct xkb_keymap *keymap, xkb_keycode_t key,
unsigned int group, unsigned int level,
const xkb_keysym_t **syms_out);
-/*
- * Canonicalises component names by prepending the relevant component from
- * 'old' to the one in 'names' when the latter has a leading '+' or '|', and
- * by replacing a '%' with the relevant component, e.g.:
- *
- * names old output
- * ------------------------------------------
- * +bar foo foo+bar
- * |quux baz baz|quux
- * foo+%|baz bar foo+bar|baz
- *
- * If a component in names needs to be modified, the existing value will be
- * free()d, and a new one allocated with malloc().
- */
-void
-xkb_canonicalise_components(struct xkb_component_names *names,
- const struct xkb_component_names *old);
-
/**
* Deprecated entrypoint for legacy users who need to be able to compile
* XKB keymaps by KcCGST (Keycodes + Compat + Geometry + Symbols + Types)
diff --git a/src/xkb.c b/src/xkb.c
index 94642e3..9d9d0ba 100644
--- a/src/xkb.c
+++ b/src/xkb.c
@@ -26,70 +26,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "xkb-priv.h"
-static char *
-XkbcCanonicaliseComponent(char *name, const char *old)
-{
- char *tmp;
- int i;
-
- if (!name)
- return NULL;
-
- /* Treachery. */
- if (old && strchr(old, '%'))
- return NULL;
-
- if (name[0] == '+' || name[0] == '|') {
- if (old) {
- tmp = malloc(strlen(name) + strlen(old) + 1);
- if (!tmp)
- return NULL;
- sprintf(tmp, "%s%s", old, name);
- free(name);
- name = tmp;
- }
- else {
- memmove(name, &name[1], strlen(&name[1]) + 1);
- }
- }
-
- for (i = 0; name[i]; i++) {
- if (name[i] == '%') {
- if (old) {
- tmp = malloc(strlen(name) + strlen(old));
- if (!tmp)
- return NULL;
- strncpy(tmp, name, i);
- strcat(tmp + i, old);
- strcat(tmp + i + strlen(old), &name[i + 1]);
- free(name);
- name = tmp;
- i--;
- }
- else {
- memmove(&name[i - 1], &name[i + 1], strlen(&name[i + 1]) + 1);
- i -= 2;
- }
- }
- }
-
- return name;
-}
-
-_X_EXPORT void
-xkb_canonicalise_components(struct xkb_component_names * names,
- const struct xkb_component_names * old)
-{
- names->keycodes = XkbcCanonicaliseComponent(names->keycodes,
- old ? old->keycodes : NULL);
- names->compat = XkbcCanonicaliseComponent(names->compat,
- old ? old->compat : NULL);
- names->symbols = XkbcCanonicaliseComponent(names->symbols,
- old ? old->symbols : NULL);
- names->types = XkbcCanonicaliseComponent(names->types,
- old ? old->types : NULL);
-}
-
static bool
VirtualModsToReal(struct xkb_keymap *keymap, unsigned virtual_mask,
unsigned *mask_rtrn)
diff --git a/test/canonicalise.c b/test/canonicalise.c
deleted file mode 100644
index c437345..0000000
--- a/test/canonicalise.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright © 2009 Daniel Stone
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Author: Daniel Stone <daniel@fooishbar.org>
- */
-
-#include <assert.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "xkbcommon/xkbcommon.h"
-#include "xkb-priv.h"
-
-struct test_data {
- struct xkb_component_names new;
- struct xkb_component_names old;
- int pass_old;
- const char *exp_keycodes;
- const char *exp_compat;
- const char *exp_symbols;
- const char *exp_types;
-};
-
-static struct test_data *
-new_data(void)
-{
- return calloc(1, sizeof(struct test_data));
-}
-
-static void
-free_data(struct test_data *data)
-{
- free(data->new.keycodes);
- free(data->new.compat);
- free(data->new.symbols);
- free(data->new.types);
- free(data->old.keycodes);
- free(data->old.compat);
- free(data->old.symbols);
- free(data->old.types);
- free(data);
-}
-
-static void
-set_new(struct test_data *data, const char *keycodes, const char *compat,
- const char *symbols, const char *types)
-{
- data->new.keycodes = strdup(keycodes);
- data->new.compat = strdup(compat);
- data->new.symbols = strdup(symbols);
- data->new.types = strdup(types);
-}
-
-static void
-set_old(struct test_data *data, const char *keycodes, const char *compat,
- const char *symbols, const char *types)
-{
- data->old.keycodes = strdup(keycodes);
- data->old.compat = strdup(compat);
- data->old.symbols = strdup(symbols);
- data->old.types = strdup(types);
- data->pass_old = 1;
-}
-
-static void
-set_exp(struct test_data *data, const char *keycodes, const char *compat,
- const char *symbols, const char *types)
-{
- data->exp_keycodes = keycodes;
- data->exp_compat = compat;
- data->exp_symbols = symbols;
- data->exp_types = types;
-}
-
-static int
-test_canonicalise(struct test_data *data)
-{
- fprintf(stderr, "New: %s %s %s %s\n", data->new.keycodes,
- data->new.compat, data->new.symbols, data->new.types);
- if (data->pass_old)
- fprintf(stderr, "Old: %s %s %s %s\n", data->old.keycodes,
- data->old.compat, data->old.symbols, data->old.types);
- fprintf(stderr, "Expected: %s %s %s %s\n", data->exp_keycodes,
- data->exp_compat, data->exp_symbols, data->exp_types);
-
- if (data->pass_old)
- xkb_canonicalise_components(&data->new, &data->old);
- else
- xkb_canonicalise_components(&data->new, NULL);
-
- fprintf(stderr, "Received: %s %s %s %s\n\n", data->new.keycodes,
- data->new.compat, data->new.symbols, data->new.types);
-
- return (strcmp(data->new.keycodes, data->exp_keycodes) == 0) &&
- (strcmp(data->new.compat, data->exp_compat) == 0) &&
- (strcmp(data->new.symbols, data->exp_symbols) == 0) &&
- (strcmp(data->new.types, data->exp_types) == 0);
-}
-
-int
-main(void)
-{
- struct test_data *twopart, *onepart;
-
- twopart = new_data();
- set_new(twopart, "+inet(pc104)", "%+complete", "pc(pc104)+%+ctrl(nocaps)", "|complete");
- set_old(twopart, "xfree86", "basic", "us(dvorak)", "xfree86");
- set_exp(twopart, "xfree86+inet(pc104)", "basic+complete", "pc(pc104)+us(dvorak)+ctrl(nocaps)", "xfree86|complete");
- assert(test_canonicalise(twopart));
- free_data(twopart);
-
- onepart = new_data();
- set_new(onepart, "evdev", "complete", "pc(pc104)+us+compose(ralt)", "complete");
- set_exp(onepart, "evdev", "complete", "pc(pc104)+us+compose(ralt)", "complete");
- assert(test_canonicalise(onepart));
- free_data(onepart);
-
- return 0;
-}