1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-01-16 16:19:10 +00:00

Fix memory leak in make_X_keymap(). Ref #64

Add extra debugging printfs for X keyboard mapping under ifdef DEBUG.

	modified:   src/initkbd.c
This commit is contained in:
Nick Briggs 2020-11-11 18:33:43 -08:00
parent 3db585e2b2
commit b9fa900512

View File

@ -502,7 +502,12 @@ static int find_unused_key(KeySym *map, int minkey, int codecount, int symsperco
for (i = 0; i < (codecount * symspercode); i++) {
if (sym == map[i]) {
int code = minkey + (i / symspercode);
if (table[code - 7] != 255) continue;
if (table[code - 7] != 255) {
#ifdef DEBUG
printf("table[%d - 7] != 255\n", code);
#endif
continue;
}
return (code);
}
}
@ -561,7 +566,18 @@ static u_char *make_X_keymap() {
table[xcode - 7] = code;
}
XFree(mapping); /* No locking required? */
#ifdef DEBUG
printf("\n\n\tXGetKeyboardMapping table\n\n");
for (i = 0; i < codecount * symspercode; i += symspercode) {
printf("%d:", minkey + (i / symspercode));
for (int j = 0; j < symspercode; j++) {
printf("\t %8x", mapping[i+j]);
}
printf("\n");
}
printf("\n\n\tKeyboard mapping table\n\n");
for (i = 0; i < 256; i += 8) {
printf("%d:\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n", i, table[i], table[i + 1], table[i + 2], table[i + 3], table[i + 4],