xkb: XkbSendNames(): pass in struct as value instead of pointer
The function doesn't need to pass anything back via this pointer, it's the last consumer of this struct. Make understanding the code a bit easier and clear the road for further simplifications by passing the struct as value instead of pointer. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
580b0b7aff
commit
b3e91dea97
38
xkb/xkb.c
38
xkb/xkb.c
|
@ -3784,20 +3784,20 @@ XkbComputeGetNamesReplySize(XkbDescPtr xkb, xkbGetNamesReply * rep)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
XkbSendNames(ClientPtr client, XkbDescPtr xkb, xkbGetNamesReply * rep)
|
XkbSendNames(ClientPtr client, XkbDescPtr xkb, xkbGetNamesReply rep)
|
||||||
{
|
{
|
||||||
register unsigned i, length, which;
|
register unsigned i, length, which;
|
||||||
char *start;
|
char *start;
|
||||||
char *desc;
|
char *desc;
|
||||||
|
|
||||||
length = rep->length * 4;
|
length = rep.length * 4;
|
||||||
which = rep->which;
|
which = rep.which;
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swaps(&rep->sequenceNumber);
|
swaps(&rep.sequenceNumber);
|
||||||
swapl(&rep->length);
|
swapl(&rep.length);
|
||||||
swapl(&rep->which);
|
swapl(&rep.which);
|
||||||
swaps(&rep->virtualMods);
|
swaps(&rep.virtualMods);
|
||||||
swapl(&rep->indicators);
|
swapl(&rep.indicators);
|
||||||
}
|
}
|
||||||
|
|
||||||
start = desc = calloc(1, length);
|
start = desc = calloc(1, length);
|
||||||
|
@ -3864,10 +3864,10 @@ XkbSendNames(ClientPtr client, XkbDescPtr xkb, xkbGetNamesReply * rep)
|
||||||
XkbKeyTypePtr type = xkb->map->types;
|
XkbKeyTypePtr type = xkb->map->types;
|
||||||
register CARD32 *atm;
|
register CARD32 *atm;
|
||||||
|
|
||||||
for (i = 0; i < rep->nTypes; i++, type++) {
|
for (i = 0; i < rep.nTypes; i++, type++) {
|
||||||
*desc++ = type->num_levels;
|
*desc++ = type->num_levels;
|
||||||
}
|
}
|
||||||
desc += XkbPaddedSize(rep->nTypes) - rep->nTypes;
|
desc += XkbPaddedSize(rep.nTypes) - rep.nTypes;
|
||||||
|
|
||||||
atm = (CARD32 *) desc;
|
atm = (CARD32 *) desc;
|
||||||
type = xkb->map->types;
|
type = xkb->map->types;
|
||||||
|
@ -3899,29 +3899,29 @@ XkbSendNames(ClientPtr client, XkbDescPtr xkb, xkbGetNamesReply * rep)
|
||||||
client->swapped);
|
client->swapped);
|
||||||
}
|
}
|
||||||
if (which & XkbKeyNamesMask) {
|
if (which & XkbKeyNamesMask) {
|
||||||
for (i = 0; i < rep->nKeys; i++, desc += sizeof(XkbKeyNameRec)) {
|
for (i = 0; i < rep.nKeys; i++, desc += sizeof(XkbKeyNameRec)) {
|
||||||
*((XkbKeyNamePtr) desc) = xkb->names->keys[i + rep->firstKey];
|
*((XkbKeyNamePtr) desc) = xkb->names->keys[i + rep.firstKey];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (which & XkbKeyAliasesMask) {
|
if (which & XkbKeyAliasesMask) {
|
||||||
XkbKeyAliasPtr pAl;
|
XkbKeyAliasPtr pAl;
|
||||||
|
|
||||||
pAl = xkb->names->key_aliases;
|
pAl = xkb->names->key_aliases;
|
||||||
for (i = 0; i < rep->nKeyAliases;
|
for (i = 0; i < rep.nKeyAliases;
|
||||||
i++, pAl++, desc += 2 * XkbKeyNameLength) {
|
i++, pAl++, desc += 2 * XkbKeyNameLength) {
|
||||||
*((XkbKeyAliasPtr) desc) = *pAl;
|
*((XkbKeyAliasPtr) desc) = *pAl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((which & XkbRGNamesMask) && (rep->nRadioGroups > 0)) {
|
if ((which & XkbRGNamesMask) && (rep.nRadioGroups > 0)) {
|
||||||
register CARD32 *atm = (CARD32 *) desc;
|
register CARD32 *atm = (CARD32 *) desc;
|
||||||
|
|
||||||
for (i = 0; i < rep->nRadioGroups; i++, atm++) {
|
for (i = 0; i < rep.nRadioGroups; i++, atm++) {
|
||||||
*atm = (CARD32) xkb->names->radio_groups[i];
|
*atm = (CARD32) xkb->names->radio_groups[i];
|
||||||
if (client->swapped) {
|
if (client->swapped) {
|
||||||
swapl(atm);
|
swapl(atm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
desc += rep->nRadioGroups * 4;
|
desc += rep.nRadioGroups * 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3929,7 +3929,7 @@ XkbSendNames(ClientPtr client, XkbDescPtr xkb, xkbGetNamesReply * rep)
|
||||||
ErrorF("[xkb] BOGUS LENGTH in write names, expected %d, got %ld\n",
|
ErrorF("[xkb] BOGUS LENGTH in write names, expected %d, got %ld\n",
|
||||||
length, (unsigned long) (desc - start));
|
length, (unsigned long) (desc - start));
|
||||||
}
|
}
|
||||||
WriteToClient(client, SIZEOF(xkbGetNamesReply), rep);
|
WriteToClient(client, sizeof(rep), &rep);
|
||||||
WriteToClient(client, length, start);
|
WriteToClient(client, length, start);
|
||||||
free((char *) start);
|
free((char *) start);
|
||||||
return Success;
|
return Success;
|
||||||
|
@ -3964,7 +3964,7 @@ ProcXkbGetNames(ClientPtr client)
|
||||||
.nRadioGroups = xkb->names ? xkb->names->num_rg : 0
|
.nRadioGroups = xkb->names ? xkb->names->num_rg : 0
|
||||||
};
|
};
|
||||||
XkbComputeGetNamesReplySize(xkb, &rep);
|
XkbComputeGetNamesReplySize(xkb, &rep);
|
||||||
return XkbSendNames(client, xkb, &rep);
|
return XkbSendNames(client, xkb, rep);
|
||||||
}
|
}
|
||||||
|
|
||||||
/***====================================================================***/
|
/***====================================================================***/
|
||||||
|
@ -6099,7 +6099,7 @@ ProcXkbGetKbdByName(ClientPtr client)
|
||||||
if (reported & XkbGBN_IndicatorMapMask)
|
if (reported & XkbGBN_IndicatorMapMask)
|
||||||
XkbSendIndicatorMap(client, new->indicators, irep);
|
XkbSendIndicatorMap(client, new->indicators, irep);
|
||||||
if (reported & (XkbGBN_KeyNamesMask | XkbGBN_OtherNamesMask))
|
if (reported & (XkbGBN_KeyNamesMask | XkbGBN_OtherNamesMask))
|
||||||
XkbSendNames(client, new, &nrep);
|
XkbSendNames(client, new, nrep);
|
||||||
if (reported & XkbGBN_GeometryMask)
|
if (reported & XkbGBN_GeometryMask)
|
||||||
XkbSendGeometry(client, new->geom, &grep);
|
XkbSendGeometry(client, new->geom, &grep);
|
||||||
if (rep.loaded) {
|
if (rep.loaded) {
|
||||||
|
|
Loading…
Reference in New Issue