Use void* instead of old style char* in CommonInfo functions

Removes some annoying casts.

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2012-06-27 00:22:31 +03:00
parent 2cb6c35b87
commit f637d35a86
6 changed files with 14 additions and 19 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}
/***====================================================================***/

View File

@ -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