diff --git a/Xext/sync.c b/Xext/sync.c index 5809c5c4d..6d186e3f3 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -1271,18 +1271,11 @@ ProcSyncInitialize(ClientPtr client) REQUEST_HEAD_STRUCT(xSyncInitializeReq); xSyncInitializeReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, .majorVersion = SERVER_SYNC_MAJOR_VERSION, .minorVersion = SERVER_SYNC_MINOR_VERSION, }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - } - WriteToClient(client, sizeof(rep), &rep); - return Success; + REPLY_SEND_RET_SUCCESS(); } /* @@ -1294,10 +1287,9 @@ ProcSyncListSystemCounters(ClientPtr client) REQUEST_HEAD_STRUCT(xSyncListSystemCountersReq); xSyncListSystemCountersReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, .nCounters = 0, }; + SysCounterInfo *psci; int len = 0; xSyncSystemCounter *list = NULL, *walklist = NULL; @@ -1314,13 +1306,7 @@ ProcSyncListSystemCounters(ClientPtr client) return BadAlloc; } - rep.length = bytes_to_int32(len); - - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.nCounters); - } + REPLY_FIELD_CARD32(nCounters); xorg_list_for_each_entry(psci, &SysCounterList, entry) { int namelen; @@ -1332,12 +1318,8 @@ ProcSyncListSystemCounters(ClientPtr client) namelen = strlen(psci->name); walklist->name_length = namelen; - if (client->swapped) { - swapl(&walklist->counter); - swapl(&walklist->resolution_hi); - swapl(&walklist->resolution_lo); - swaps(&walklist->name_length); - } + CLIENT_STRUCT_CARD16_1(walklist, name_length); + CLIENT_STRUCT_CARD32_3(walklist, counter, resolution_hi, resolution_lo); pname_in_reply = ((char *) walklist) + sz_xSyncSystemCounter; strncpy(pname_in_reply, psci->name, namelen); @@ -1346,12 +1328,7 @@ ProcSyncListSystemCounters(ClientPtr client) namelen)); } - WriteToClient(client, sizeof(rep), &rep); - if (len) { - WriteToClient(client, len, list); - free(list); - } - + REPLY_SEND_EXTRA(list, len); return Success; } @@ -1401,34 +1378,23 @@ ProcSyncGetPriority(ClientPtr client) REQUEST_HEAD_STRUCT(xSyncGetPriorityReq); REQUEST_FIELD_CARD32(id); - xSyncGetPriorityReply rep; ClientPtr priorityclient; - int rc; if (stuff->id == None) priorityclient = client; else { - rc = dixLookupResourceOwner(&priorityclient, stuff->id, client, + int rc = dixLookupResourceOwner(&priorityclient, stuff->id, client, DixGetAttrAccess); if (rc != Success) return rc; } - rep = (xSyncGetPriorityReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, + xSyncGetPriorityReply rep = { .priority = priorityclient->priority }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.priority); - } - - WriteToClient(client, sizeof(xSyncGetPriorityReply), &rep); - - return Success; + REPLY_FIELD_CARD32(priority); + REPLY_SEND_RET_SUCCESS(); } /* @@ -1691,7 +1657,6 @@ ProcSyncQueryCounter(ClientPtr client) REQUEST_HEAD_STRUCT(xSyncQueryCounterReq); REQUEST_FIELD_CARD32(counter); - xSyncQueryCounterReply rep; SyncCounter *pCounter; int rc; @@ -1706,22 +1671,14 @@ ProcSyncQueryCounter(ClientPtr client) &pCounter->value); } - rep = (xSyncQueryCounterReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, + xSyncQueryCounterReply rep = (xSyncQueryCounterReply) { .value_hi = pCounter->value >> 32, .value_lo = pCounter->value }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.value_hi); - swapl(&rep.value_lo); - } - WriteToClient(client, sizeof(xSyncQueryCounterReply), &rep); - return Success; + REPLY_FIELD_CARD32(value_hi); + REPLY_FIELD_CARD32(value_lo); + REPLY_SEND_RET_SUCCESS(); } /* @@ -1862,7 +1819,6 @@ ProcSyncQueryAlarm(ClientPtr client) REQUEST_FIELD_CARD32(alarm); SyncAlarm *pAlarm; - xSyncQueryAlarmReply rep; SyncTrigger *pTrigger; int rc; @@ -1872,9 +1828,7 @@ ProcSyncQueryAlarm(ClientPtr client) return rc; pTrigger = &pAlarm->trigger; - rep = (xSyncQueryAlarmReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, + xSyncQueryAlarmReply rep = { .length = bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply)), .counter = (pTrigger->pSync) ? pTrigger->pSync->id : None, @@ -1899,19 +1853,13 @@ ProcSyncQueryAlarm(ClientPtr client) .state = pAlarm->state }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.counter); - swapl(&rep.wait_value_hi); - swapl(&rep.wait_value_lo); - swapl(&rep.test_type); - swapl(&rep.delta_hi); - swapl(&rep.delta_lo); - } - - WriteToClient(client, sizeof(xSyncQueryAlarmReply), &rep); - return Success; + REPLY_FIELD_CARD32(counter); + REPLY_FIELD_CARD32(wait_value_hi); + REPLY_FIELD_CARD32(wait_value_lo); + REPLY_FIELD_CARD32(test_type); + REPLY_FIELD_CARD32(delta_hi); + REPLY_FIELD_CARD32(delta_lo); + REPLY_SEND_RET_SUCCESS(); } static int @@ -2044,7 +1992,6 @@ ProcSyncQueryFence(ClientPtr client) REQUEST_HEAD_STRUCT(xSyncQueryFenceReq); REQUEST_FIELD_CARD32(fid); - xSyncQueryFenceReply rep; SyncFence *pFence; int rc; @@ -2053,21 +2000,11 @@ ProcSyncQueryFence(ClientPtr client) if (rc != Success) return rc; - rep = (xSyncQueryFenceReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - + xSyncQueryFenceReply rep = (xSyncQueryFenceReply) { .triggered = pFence->funcs.CheckTriggered(pFence) }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - } - - WriteToClient(client, sizeof(xSyncQueryFenceReply), &rep); - return Success; + REPLY_SEND_RET_SUCCESS(); } static int