Make XkbcInitAtoms() call optional

master
Kristian Høgsberg 2010-06-30 17:13:21 -04:00
parent 0ece2cdbaf
commit d95b289367
4 changed files with 9 additions and 13 deletions

View File

@ -105,13 +105,6 @@ XkbcInitAtoms(InternAtomFuncPtr intern, GetAtomValueFuncPtr get_atom_value)
do_get_atom_value = get_atom_value; do_get_atom_value = get_atom_value;
return; return;
} }
if (nodeTable)
return;
tableLength = InitialTableSize;
nodeTable = (NodePtr *)malloc(InitialTableSize * sizeof(NodePtr));
nodeTable[None] = NULL;
} }
static const char * static const char *
@ -202,16 +195,22 @@ _XkbcMakeAtom(const char *string, unsigned len, Bool makeit)
if ((lastAtom + 1) >= tableLength) { if ((lastAtom + 1) >= tableLength) {
NodePtr *table; NodePtr *table;
int newLength;
table = (NodePtr *)realloc(nodeTable, if (tableLength == 0)
tableLength * 2 * sizeof(NodePtr)); newLength = InitialTableSize;
else
newLength = tableLength * 2;
table = realloc(nodeTable, newLength * sizeof(NodePtr));
if (!table) { if (!table) {
if (nd->string != string) if (nd->string != string)
free(nd->string); free(nd->string);
free(nd); free(nd);
return BAD_RESOURCE; return BAD_RESOURCE;
} }
tableLength <<= 1; tableLength = newLength;
table[None] = NULL;
nodeTable = table; nodeTable = table;
} }

View File

@ -60,7 +60,6 @@ int main(int argc, char *argv[])
} }
uSetErrorFile(NULL); uSetErrorFile(NULL);
XkbcInitAtoms(NULL, NULL);
xkb = XkbcCompileKeymapFromFile(file, name); xkb = XkbcCompileKeymapFromFile(file, name);
fclose(file); fclose(file);

View File

@ -54,7 +54,6 @@ int main(int argc, char *argv[])
ktcsg.geometry = argv[5]; ktcsg.geometry = argv[5];
uSetErrorFile(NULL); uSetErrorFile(NULL);
XkbcInitAtoms(NULL, NULL);
xkb = XkbcCompileKeymapFromComponents(&ktcsg); xkb = XkbcCompileKeymapFromComponents(&ktcsg);

View File

@ -53,7 +53,6 @@ int main(int argc, char *argv[])
rmlvo.options = argv[5]; rmlvo.options = argv[5];
uSetErrorFile(NULL); uSetErrorFile(NULL);
XkbcInitAtoms(NULL, NULL);
xkb = XkbcCompileKeymapFromRules(&rmlvo); xkb = XkbcCompileKeymapFromRules(&rmlvo);