Use void* instead of old style char* in CommonInfo functions Removes some annoying casts. Signed-off-by: Ran Benita <ran234@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
diff --git a/src/xkbcomp/alias.c b/src/xkbcomp/alias.c
index ae1ebdc..fa70888 100644
--- a/src/xkbcomp/alias.c
+++ b/src/xkbcomp/alias.c
@@ -106,7 +106,7 @@ HandleAliasDef(KeyAliasDef * def,
info->def.next = (CommonInfo *) * info_in;
memcpy(info->alias, def->alias, XkbKeyNameLength);
memcpy(info->real, def->real, XkbKeyNameLength);
- *info_in = (AliasInfo *) AddCommonInfo(&(*info_in)->def, &info->def);
+ *info_in = AddCommonInfo(&(*info_in)->def, &info->def);
return true;
}
diff --git a/src/xkbcomp/compat.c b/src/xkbcomp/compat.c
index b256431..7ea226a 100644
--- a/src/xkbcomp/compat.c
+++ b/src/xkbcomp/compat.c
@@ -142,10 +142,10 @@ ClearCompatInfo(CompatInfo *info, struct xkb_keymap *keymap)
info->dflt.interp.act.any.data[i] = 0;
ClearIndicatorMapInfo(keymap->ctx, &info->ledDflt);
info->nInterps = 0;
- info->interps = (SymInterpInfo *) ClearCommonInfo(&info->interps->defs);
+ info->interps = ClearCommonInfo(&info->interps->defs);
memset(&info->groupCompat[0], 0,
XkbNumKbdGroups * sizeof(GroupCompatInfo));
- info->leds = (LEDInfo *) ClearCommonInfo(&info->leds->defs);
+ info->leds = ClearCommonInfo(&info->leds->defs);
while (info->act) {
next = info->act->next;
free(info->act);
@@ -163,9 +163,7 @@ NextInterp(CompatInfo * info)
if (si)
{
memset(si, 0, sizeof(SymInterpInfo));
- info->interps =
- (SymInterpInfo *) AddCommonInfo(&info->interps->defs,
- (CommonInfo *) si);
+ info->interps = AddCommonInfo(&info->interps->defs, &si->defs);
info->nInterps++;
}
return si;
diff --git a/src/xkbcomp/keycodes.c b/src/xkbcomp/keycodes.c
index b9115f4..04c027c 100644
--- a/src/xkbcomp/keycodes.c
+++ b/src/xkbcomp/keycodes.c
@@ -121,8 +121,7 @@ NextIndicatorName(KeyNamesInfo * info)
if (ii)
{
InitIndicatorNameInfo(ii, info);
- info->leds = (IndicatorNameInfo *) AddCommonInfo(&info->leds->defs,
- (CommonInfo *) ii);
+ info->leds = AddCommonInfo(&info->leds->defs, &ii->defs);
}
return ii;
}
diff --git a/src/xkbcomp/keytypes.c b/src/xkbcomp/keytypes.c
index 9898e1d..599a0f2 100644
--- a/src/xkbcomp/keytypes.c
+++ b/src/xkbcomp/keytypes.c
@@ -176,7 +176,7 @@ FreeKeyTypesInfo(KeyTypesInfo * info)
{
FreeKeyTypeInfo(type);
}
- info->types = (KeyTypeInfo *) ClearCommonInfo(&info->types->defs);
+ info->types = ClearCommonInfo(&info->types->defs);
}
FreeKeyTypeInfo(&info->dflt);
}
@@ -191,8 +191,7 @@ NextKeyType(KeyTypesInfo * info)
{
memset(type, 0, sizeof(KeyTypeInfo));
type->defs.fileID = info->fileID;
- info->types = (KeyTypeInfo *) AddCommonInfo(&info->types->defs,
- (CommonInfo *) type);
+ info->types = AddCommonInfo(&info->types->defs, &type->defs);
info->nTypes++;
}
return type;
@@ -507,8 +506,7 @@ AddPreserve(struct xkb_keymap *keymap, KeyTypeInfo *type,
}
*old = *new;
old->matchingMapIndex = -1;
- type->preserve =
- (PreserveInfo *) AddCommonInfo(&type->preserve->defs, &old->defs);
+ type->preserve = AddCommonInfo(&type->preserve->defs, &old->defs);
return true;
}
diff --git a/src/xkbcomp/misc.c b/src/xkbcomp/misc.c
index 5ff1e65..e9b42ba 100644
--- a/src/xkbcomp/misc.c
+++ b/src/xkbcomp/misc.c
@@ -178,7 +178,7 @@ UseNewField(unsigned field,
return useNew;
}
-char *
+void *
ClearCommonInfo(CommonInfo * cmn)
{
if (cmn != NULL)
@@ -193,7 +193,7 @@ ClearCommonInfo(CommonInfo * cmn)
return NULL;
}
-char *
+void *
AddCommonInfo(CommonInfo * old, CommonInfo * new)
{
CommonInfo *first;
@@ -207,9 +207,9 @@ AddCommonInfo(CommonInfo * old, CommonInfo * new)
if (old)
{
old->next = new;
- return (char *) first;
+ return first;
}
- return (char *) new;
+ return new;
}
/***====================================================================***/
diff --git a/src/xkbcomp/xkbcomp-priv.h b/src/xkbcomp/xkbcomp-priv.h
index 09bdd2a..85a9c02 100644
--- a/src/xkbcomp/xkbcomp-priv.h
+++ b/src/xkbcomp/xkbcomp-priv.h
@@ -44,10 +44,10 @@ extern bool
UseNewField(unsigned field, CommonInfo *oldDefs, CommonInfo *newDefs,
unsigned *pCollide);
-extern char *
+extern void *
ClearCommonInfo(CommonInfo *cmn);
-extern char *
+extern void *
AddCommonInfo(CommonInfo *old, CommonInfo *new);
extern int