summaryrefslogtreecommitdiff
path: root/xkb
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2010-01-15 15:32:10 +1000
committerKeith Packard <keithp@keithp.com>2010-01-25 09:25:21 +1300
commitd627dd9d1ef436b01f0581e40a6736ffc6b5d2c8 (patch)
tree2df40c77f1cd4ce2c8d27a48b19b7959a44d4875 /xkb
parentea1de3fcdc40d2060bb6d13775005eadd624e767 (diff)
xkb: remove _XkbClearElems, a memset will do.
Bonus point - it's easier to understand what's actually being done with the memory. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Fernando Carrijo <fcarrijo@yahoo.com.br> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'xkb')
-rw-r--r--xkb/XKBAlloc.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/xkb/XKBAlloc.c b/xkb/XKBAlloc.c
index 312f54ef9..6464e9970 100644
--- a/xkb/XKBAlloc.c
+++ b/xkb/XKBAlloc.c
@@ -36,6 +36,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <xkbsrv.h>
#include "xkbgeom.h"
#include <os.h>
+#include <string.h>
/***===================================================================***/
@@ -64,8 +65,8 @@ XkbSymInterpretRec *prev_interpret;
return BadAlloc;
}
if (compat->num_si!=0) {
- _XkbClearElems(compat->sym_interpret,compat->num_si,
- compat->size_si-1,XkbSymInterpretRec);
+ memset(&compat->sym_interpret[compat->num_si], 0,
+ (compat->size_si - compat->num_si) * sizeof(XkbSymInterpretRec));
}
return Success;
}
@@ -159,8 +160,8 @@ XkbNamesPtr names;
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);
+ memset(&names->key_aliases[names->num_key_aliases], 0,
+ (nTotalAliases - names->num_key_aliases) * sizeof(XkbKeyAliasRec));
} else {
xfree(prev_aliases);
}
@@ -181,8 +182,8 @@ XkbNamesPtr names;
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);
+ memset(&names->radio_groups[names->num_rg], 0,
+ (nTotalRG - names->num_rg) * sizeof(Atom));
} else {
xfree(prev_radio_groups);
}