summaryrefslogtreecommitdiff
path: root/xkb/XKBAlloc.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2010-01-15 15:32:09 +1000
committerKeith Packard <keithp@keithp.com>2010-01-25 09:24:31 +1300
commitea1de3fcdc40d2060bb6d13775005eadd624e767 (patch)
tree277129a182d09d7996dabf52ce1fbe3f247d28aa /xkb/XKBAlloc.c
parent0f2d297dedeff8bd227df4c498cc668b0e902344 (diff)
xkb: remove _XkbTyped*alloc
Please no extension-specific macros for memory allocation. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Dan Nicholson <dbn.lists@gmail.com> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'xkb/XKBAlloc.c')
-rw-r--r--xkb/XKBAlloc.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c
index 7265d83f2..312f54ef9 100644
--- a/xkb/XKBAlloc.c
+++ b/xkb/XKBAlloc.c
@@ -35,6 +35,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "inputstr.h"
#include <xkbsrv.h>
#include "xkbgeom.h"
+#include <os.h>
/***===================================================================***/
@@ -55,8 +56,8 @@ XkbSymInterpretRec *prev_interpret;
if (compat->sym_interpret==NULL)
compat->num_si= 0;
prev_interpret = compat->sym_interpret;
- compat->sym_interpret= _XkbTypedRealloc(compat->sym_interpret,
- nSI,XkbSymInterpretRec);
+ compat->sym_interpret= xrealloc(compat->sym_interpret,
+ nSI * sizeof(XkbSymInterpretRec));
if (compat->sym_interpret==NULL) {
xfree(prev_interpret);
compat->size_si= compat->num_si= 0;
@@ -68,11 +69,11 @@ XkbSymInterpretRec *prev_interpret;
}
return Success;
}
- compat= _XkbTypedCalloc(1,XkbCompatMapRec);
+ compat= xcalloc(1, sizeof(XkbCompatMapRec));
if (compat==NULL)
return BadAlloc;
if (nSI>0) {
- compat->sym_interpret= _XkbTypedCalloc(nSI,XkbSymInterpretRec);
+ compat->sym_interpret= xcalloc(nSI, sizeof(XkbSymInterpretRec));
if (!compat->sym_interpret) {
xfree(compat);
return BadAlloc;
@@ -121,7 +122,7 @@ XkbNamesPtr names;
if (xkb==NULL)
return BadMatch;
if (xkb->names==NULL) {
- xkb->names = _XkbTypedCalloc(1,XkbNamesRec);
+ xkb->names = xcalloc(1, sizeof(XkbNamesRec));
if (xkb->names==NULL)
return BadAlloc;
}
@@ -133,7 +134,7 @@ XkbNamesPtr names;
type= xkb->map->types;
for (i=0;i<xkb->map->num_types;i++,type++) {
if (type->level_names==NULL) {
- type->level_names= _XkbTypedCalloc(type->num_levels,Atom);
+ type->level_names= xcalloc(type->num_levels, sizeof(Atom));
if (type->level_names==NULL)
return BadAlloc;
}
@@ -144,19 +145,19 @@ XkbNamesPtr names;
(!XkbIsLegalKeycode(xkb->max_key_code))||
(xkb->max_key_code<xkb->min_key_code))
return BadValue;
- names->keys= _XkbTypedCalloc((xkb->max_key_code+1),XkbKeyNameRec);
+ names->keys= xcalloc((xkb->max_key_code+1), sizeof(XkbKeyNameRec));
if (names->keys==NULL)
return BadAlloc;
}
if ((which&XkbKeyAliasesMask)&&(nTotalAliases>0)) {
if (names->key_aliases==NULL) {
- names->key_aliases= _XkbTypedCalloc(nTotalAliases,XkbKeyAliasRec);
+ names->key_aliases= xcalloc(nTotalAliases, sizeof(XkbKeyAliasRec));
}
else if (nTotalAliases>names->num_key_aliases) {
XkbKeyAliasRec *prev_aliases = names->key_aliases;
- names->key_aliases= _XkbTypedRealloc(names->key_aliases,
- nTotalAliases,XkbKeyAliasRec);
+ names->key_aliases= xrealloc(names->key_aliases,
+ nTotalAliases * sizeof(XkbKeyAliasRec));
if (names->key_aliases!=NULL) {
_XkbClearElems(names->key_aliases,names->num_key_aliases,
nTotalAliases-1,XkbKeyAliasRec);
@@ -172,13 +173,13 @@ XkbNamesPtr names;
}
if ((which&XkbRGNamesMask)&&(nTotalRG>0)) {
if (names->radio_groups==NULL) {
- names->radio_groups= _XkbTypedCalloc(nTotalRG,Atom);
+ names->radio_groups= xcalloc(nTotalRG, sizeof(Atom));
}
else if (nTotalRG>names->num_rg) {
Atom *prev_radio_groups = names->radio_groups;
- names->radio_groups= _XkbTypedRealloc(names->radio_groups,nTotalRG,
- Atom);
+ names->radio_groups= xrealloc(names->radio_groups,
+ nTotalRG * sizeof(Atom));
if (names->radio_groups!=NULL) {
_XkbClearElems(names->radio_groups,names->num_rg,nTotalRG-1,
Atom);
@@ -249,7 +250,7 @@ XkbAllocControls(XkbDescPtr xkb,unsigned which)
return BadMatch;
if (xkb->ctrls==NULL) {
- xkb->ctrls= _XkbTypedCalloc(1,XkbControlsRec);
+ xkb->ctrls= xcalloc(1, sizeof(XkbControlsRec));
if (!xkb->ctrls)
return BadAlloc;
}
@@ -275,7 +276,7 @@ XkbAllocIndicatorMaps(XkbDescPtr xkb)
if (xkb==NULL)
return BadMatch;
if (xkb->indicators==NULL) {
- xkb->indicators= _XkbTypedCalloc(1,XkbIndicatorRec);
+ xkb->indicators= xcalloc(1, sizeof(XkbIndicatorRec));
if (!xkb->indicators)
return BadAlloc;
}
@@ -299,7 +300,7 @@ XkbAllocKeyboard(void)
{
XkbDescRec *xkb;
- xkb = _XkbTypedCalloc(1,XkbDescRec);
+ xkb = xcalloc(1, sizeof(XkbDescRec));
if (xkb)
xkb->device_spec= XkbUseCoreKbd;
return xkb;