summaryrefslogtreecommitdiff
path: root/src/xkbcomp/keycodes.c
diff options
context:
space:
mode:
authorRan Benita <ran234@gmail.com>2012-09-14 00:21:54 +0300
committerRan Benita <ran234@gmail.com>2012-09-14 21:09:48 +0300
commit96c21e1577fa6462efc4d98a6f72a16ba521f6a3 (patch)
tree6ea489d16d5e4a712b8831d2a9b349089c5506c2 /src/xkbcomp/keycodes.c
parent7b5a1dd556f2f4d21f7a3265e614cae3a91e36bb (diff)
downloadlibxkbcommon-96c21e1577fa6462efc4d98a6f72a16ba521f6a3.tar.gz
libxkbcommon-96c21e1577fa6462efc4d98a6f72a16ba521f6a3.tar.bz2
libxkbcommon-96c21e1577fa6462efc4d98a6f72a16ba521f6a3.zip
Clean up Init/Clear functions
- The Clear* functions should just free the memory associated with the object. If the object is used again, it is Init'd again. - s/Free/Clear if the actual pointer is not free'd. - Zeroise object in Init and only initialize non-zero fields. Signed-off-by: Ran Benita <ran234@gmail.com>
Diffstat (limited to 'src/xkbcomp/keycodes.c')
-rw-r--r--src/xkbcomp/keycodes.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c
index 274959b..f870f00 100644
--- a/src/xkbcomp/keycodes.c
+++ b/src/xkbcomp/keycodes.c
@@ -262,16 +262,11 @@ AddIndicatorName(KeyNamesInfo *info, enum merge_mode merge,
}
static void
-ClearKeyNamesInfo(KeyNamesInfo * info)
+ClearKeyNamesInfo(KeyNamesInfo *info)
{
free(info->name);
- info->name = NULL;
- info->merge = MERGE_DEFAULT;
- info->computedMax = info->explicitMax = info->explicitMin = 0;
- info->computedMin = XKB_KEYCODE_MAX;
darray_free(info->names);
darray_free(info->files);
- memset(info->indicator_names, 0, sizeof(info->indicator_names));
darray_free(info->aliases);
}
@@ -279,15 +274,11 @@ static void
InitKeyNamesInfo(KeyNamesInfo *info, struct xkb_context *ctx,
unsigned file_id)
{
- info->name = NULL;
+ memset(info, 0, sizeof(*info));
+ info->ctx = ctx;
info->merge = MERGE_DEFAULT;
- darray_init(info->aliases);
info->file_id = file_id;
- darray_init(info->names);
- darray_init(info->files);
- ClearKeyNamesInfo(info);
- info->errorCount = 0;
- info->ctx = ctx;
+ info->computedMin = XKB_KEYCODE_MAX;
}
static int