Commit f637d35a8655eaf13bbd15367df705d90a3d674d

Ran Benita 2012-06-27T00:22:31

Use void* instead of old style char* in CommonInfo functions Removes some annoying casts. Signed-off-by: Ran Benita <ran234@gmail.com>

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