diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2010-06-30 17:13:21 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2010-06-30 17:13:21 -0400 |
commit | d95b289367c4c6cd95042db35c88a6deb20c925b (patch) | |
tree | 7c8c7309f93f8a8a606aebab125c496c631d2f62 /src | |
parent | 0ece2cdbaf776a16f8864a7314ad2089a4b9980f (diff) | |
download | xorg-lib-libxkbcommon-d95b289367c4c6cd95042db35c88a6deb20c925b.tar.gz |
Make XkbcInitAtoms() call optional
Diffstat (limited to 'src')
-rw-r--r-- | src/atom.c | 19 |
1 files changed, 9 insertions, 10 deletions
@@ -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; + + if (tableLength == 0) + newLength = InitialTableSize; + else + newLength = tableLength * 2; - table = (NodePtr *)realloc(nodeTable, - tableLength * 2 * sizeof(NodePtr)); + 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; } |