aboutsummaryrefslogtreecommitdiff
path: root/libX11/src/util/makekeys.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-07-25 12:47:39 +0000
committermarha <marha@users.sourceforge.net>2009-07-25 12:47:39 +0000
commitcb897b8ffca0a68c017c2edfa523cb5ff0491962 (patch)
tree8b4e9e320258d5280ce454163c49363030626c1a /libX11/src/util/makekeys.c
parent213d71f78d6f9e35b23c00e35f9919efc9670b1e (diff)
parentc87efef42f76c2ff0dcfad2842ab369beffd21de (diff)
downloadvcxsrv-cb897b8ffca0a68c017c2edfa523cb5ff0491962.tar.gz
vcxsrv-cb897b8ffca0a68c017c2edfa523cb5ff0491962.tar.bz2
vcxsrv-cb897b8ffca0a68c017c2edfa523cb5ff0491962.zip
svn merge file:///D:/svnrepos/vcxsrv/branches/released .
Diffstat (limited to 'libX11/src/util/makekeys.c')
-rw-r--r--libX11/src/util/makekeys.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/libX11/src/util/makekeys.c b/libX11/src/util/makekeys.c
index 214ea5c80..3fe8a96e6 100644
--- a/libX11/src/util/makekeys.c
+++ b/libX11/src/util/makekeys.c
@@ -36,13 +36,10 @@ from The Open Group.
#include <X11/keysymdef.h>
#include <stdio.h>
#include <stdlib.h>
-#if defined(macII) && !defined(__STDC__) /* stdlib.h fails to define these */
-char *malloc();
-#endif /* macII */
typedef unsigned long Signature;
-#define KTNUM 3000
+#define KTNUM 4000
static struct info {
char *name;
@@ -52,11 +49,11 @@ static struct info {
#define MIN_REHASH 15
#define MATCHES 10
-char tab[KTNUM];
-unsigned short offsets[KTNUM];
-unsigned short indexes[KTNUM];
-KeySym values[KTNUM];
-char buf[1024];
+static char tab[KTNUM];
+static unsigned short offsets[KTNUM];
+static unsigned short indexes[KTNUM];
+static KeySym values[KTNUM];
+static char buf[1024];
int
main(int argc, char *argv[])
@@ -103,12 +100,11 @@ main(int argc, char *argv[])
key);
continue;
}
- name = malloc((unsigned)strlen(key)+1);
+ name = strdup(key);
if (!name) {
fprintf(stderr, "makekeys: out of memory!\n");
exit(1);
}
- (void)strcpy(name, key);
info[ksnum].name = name;
ksnum++;
if (ksnum == KTNUM) {
@@ -157,6 +153,11 @@ next1: ;
}
z = best_z;
+ if (z == 0) {
+ fprintf(stderr, "makekeys: failed to find small enough hash!\n"
+ "Try increasing KTNUM in makekeys.c\n");
+ exit(1);
+ }
printf("#ifdef NEEDKTABLE\n");
printf("const unsigned char _XkeyTable[] = {\n");
printf("0,\n");
@@ -237,6 +238,11 @@ next2: ;
}
z = best_z;
+ if (z == 0) {
+ fprintf(stderr, "makekeys: failed to find small enough hash!\n"
+ "Try increasing KTNUM in makekeys.c\n");
+ exit(1);
+ }
for (i = z; --i >= 0;)
offsets[i] = 0;
for (i = 0; i < ksnum; i++) {