Make XkbcInitAtoms() call optional
parent
0ece2cdbaf
commit
d95b289367
19
src/atom.c
19
src/atom.c
|
@ -105,13 +105,6 @@ XkbcInitAtoms(InternAtomFuncPtr intern, GetAtomValueFuncPtr get_atom_value)
|
|||
do_get_atom_value = get_atom_value;
|
||||
return;
|
||||
}
|
||||
|
||||
if (nodeTable)
|
||||
return;
|
||||
|
||||
tableLength = InitialTableSize;
|
||||
nodeTable = (NodePtr *)malloc(InitialTableSize * sizeof(NodePtr));
|
||||
nodeTable[None] = NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
|
@ -202,16 +195,22 @@ _XkbcMakeAtom(const char *string, unsigned len, Bool makeit)
|
|||
|
||||
if ((lastAtom + 1) >= tableLength) {
|
||||
NodePtr *table;
|
||||
int newLength;
|
||||
|
||||
table = (NodePtr *)realloc(nodeTable,
|
||||
tableLength * 2 * sizeof(NodePtr));
|
||||
if (tableLength == 0)
|
||||
newLength = InitialTableSize;
|
||||
else
|
||||
newLength = tableLength * 2;
|
||||
|
||||
table = realloc(nodeTable, newLength * sizeof(NodePtr));
|
||||
if (!table) {
|
||||
if (nd->string != string)
|
||||
free(nd->string);
|
||||
free(nd);
|
||||
return BAD_RESOURCE;
|
||||
}
|
||||
tableLength <<= 1;
|
||||
tableLength = newLength;
|
||||
table[None] = NULL;
|
||||
|
||||
nodeTable = table;
|
||||
}
|
||||
|
|
|
@ -60,7 +60,6 @@ int main(int argc, char *argv[])
|
|||
}
|
||||
|
||||
uSetErrorFile(NULL);
|
||||
XkbcInitAtoms(NULL, NULL);
|
||||
|
||||
xkb = XkbcCompileKeymapFromFile(file, name);
|
||||
fclose(file);
|
||||
|
|
|
@ -54,7 +54,6 @@ int main(int argc, char *argv[])
|
|||
ktcsg.geometry = argv[5];
|
||||
|
||||
uSetErrorFile(NULL);
|
||||
XkbcInitAtoms(NULL, NULL);
|
||||
|
||||
xkb = XkbcCompileKeymapFromComponents(&ktcsg);
|
||||
|
||||
|
|
|
@ -53,7 +53,6 @@ int main(int argc, char *argv[])
|
|||
rmlvo.options = argv[5];
|
||||
|
||||
uSetErrorFile(NULL);
|
||||
XkbcInitAtoms(NULL, NULL);
|
||||
|
||||
xkb = XkbcCompileKeymapFromRules(&rmlvo);
|
||||
|
||||
|
|
Loading…
Reference in New Issue