Skip to content

Commit

Permalink
Introduce a consistent coding style
Browse files Browse the repository at this point in the history
This is strictly the application of the script 'x-indent-all.sh'
from util/modular. Compared to the patch that Daniel posted in
January, I've added a few indent flags:

	-bap
	-psl
	-T PrivatePtr
	-T pmWait
	-T _XFUNCPROTOBEGIN
	-T _XFUNCPROTOEND
	-T _X_EXPORT

The typedefs were needed to make the output of sdksyms.sh match the
previous output, otherwise, the code is formatted badly enough that
sdksyms.sh generates incorrect output.

The generated code was compared with the previous version and found to
be essentially identical -- "assert" line numbers and BUILD_TIME were
the only differences found.

The comparison was done with this script:

dir1=$1
dir2=$2

for dir in $dir1 $dir2; do
	(cd $dir && find . -name '*.o' | while read file; do
		dir=`dirname $file`
		base=`basename $file .o`
		dump=$dir/$base.dump
		objdump -d $file > $dump
	done)
done

find $dir1 -name '*.dump' | while read dump; do
	otherdump=`echo $dump | sed "s;$dir1;$dir2;"`
	diff -u $dump $otherdump
done

Signed-off-by: Keith Packard <[email protected]>
Acked-by: Daniel Stone <[email protected]>
Acked-by: Alan Coopersmith <[email protected]>
  • Loading branch information
keith-packard committed Mar 21, 2012
1 parent 7519912 commit 9838b70
Show file tree
Hide file tree
Showing 1,258 changed files with 264,655 additions and 259,938 deletions.
16 changes: 8 additions & 8 deletions Xext/bigreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ from The Open Group.
void BigReqExtensionInit(INITARGS);

static int
ProcBigReqDispatch (ClientPtr client)
ProcBigReqDispatch(ClientPtr client)
{
REQUEST(xBigReqEnableReq);
xBigReqEnableReply rep;

if (client->swapped) {
swaps(&stuff->length);
swaps(&stuff->length);
}
if (stuff->brReqType != X_BigReqEnable)
return BadRequest;
return BadRequest;
REQUEST_SIZE_MATCH(xBigReqEnableReq);
client->big_requests = TRUE;
memset(&rep, 0, sizeof(xBigReqEnableReply));
Expand All @@ -61,17 +61,17 @@ ProcBigReqDispatch (ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.max_request_size = maxBigRequestSize;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.max_request_size);
swaps(&rep.sequenceNumber);
swapl(&rep.max_request_size);
}
WriteToClient(client, sizeof(xBigReqEnableReply), (char *)&rep);
WriteToClient(client, sizeof(xBigReqEnableReply), (char *) &rep);
return Success;
}

void
BigReqExtensionInit(INITARGS)
{
AddExtension(XBigReqExtensionName, 0, 0,
ProcBigReqDispatch, ProcBigReqDispatch,
NULL, StandardMinorOpcode);
ProcBigReqDispatch, ProcBigReqDispatch,
NULL, StandardMinorOpcode);
}
109 changes: 52 additions & 57 deletions Xext/dpms.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ ProcDPMSGetVersion(ClientPtr client)
rep.majorVersion = DPMSMajorVersion;
rep.minorVersion = DPMSMinorVersion;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xDPMSGetVersionReply), (char *)&rep);
WriteToClient(client, sizeof(xDPMSGetVersionReply), (char *) &rep);
return Success;
}

Expand All @@ -77,9 +77,9 @@ ProcDPMSCapable(ClientPtr client)
rep.capable = DPMSCapableFlag;

if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.sequenceNumber);
}
WriteToClient(client, sizeof(xDPMSCapableReply), (char *)&rep);
WriteToClient(client, sizeof(xDPMSCapableReply), (char *) &rep);
return Success;
}

Expand All @@ -99,12 +99,12 @@ ProcDPMSGetTimeouts(ClientPtr client)
rep.off = DPMSOffTime / MILLI_PER_SECOND;

if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.standby);
swaps(&rep.suspend);
swaps(&rep.off);
swaps(&rep.sequenceNumber);
swaps(&rep.standby);
swaps(&rep.suspend);
swaps(&rep.off);
}
WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), (char *)&rep);
WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), (char *) &rep);
return Success;
}

Expand All @@ -115,16 +115,14 @@ ProcDPMSSetTimeouts(ClientPtr client)

REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq);

if ((stuff->off != 0)&&(stuff->off < stuff->suspend))
{
client->errorValue = stuff->off;
return BadValue;
if ((stuff->off != 0) && (stuff->off < stuff->suspend)) {
client->errorValue = stuff->off;
return BadValue;
}
if ((stuff->suspend != 0) && (stuff->suspend < stuff->standby)) {
client->errorValue = stuff->suspend;
return BadValue;
}
if ((stuff->suspend != 0)&&(stuff->suspend < stuff->standby))
{
client->errorValue = stuff->suspend;
return BadValue;
}

DPMSStandbyTime = stuff->standby * MILLI_PER_SECOND;
DPMSSuspendTime = stuff->suspend * MILLI_PER_SECOND;
Expand All @@ -142,9 +140,9 @@ ProcDPMSEnable(ClientPtr client)
REQUEST_SIZE_MATCH(xDPMSEnableReq);

if (DPMSCapableFlag) {
DPMSEnabled = TRUE;
if (!was_enabled)
SetScreenSaverTimer();
DPMSEnabled = TRUE;
if (!was_enabled)
SetScreenSaverTimer();
}

return Success;
Expand Down Expand Up @@ -172,14 +170,13 @@ ProcDPMSForceLevel(ClientPtr client)
REQUEST_SIZE_MATCH(xDPMSForceLevelReq);

if (!DPMSEnabled)
return BadMatch;
return BadMatch;

if (stuff->level != DPMSModeOn &&
stuff->level != DPMSModeStandby &&
stuff->level != DPMSModeSuspend &&
stuff->level != DPMSModeOff) {
client->errorValue = stuff->level;
return BadValue;
stuff->level != DPMSModeSuspend && stuff->level != DPMSModeOff) {
client->errorValue = stuff->level;
return BadValue;
}

DPMSSet(client, stuff->level);
Expand All @@ -202,38 +199,37 @@ ProcDPMSInfo(ClientPtr client)
rep.state = DPMSEnabled;

if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.power_level);
swaps(&rep.sequenceNumber);
swaps(&rep.power_level);
}
WriteToClient(client, sizeof(xDPMSInfoReply), (char *)&rep);
WriteToClient(client, sizeof(xDPMSInfoReply), (char *) &rep);
return Success;
}

static int
ProcDPMSDispatch (ClientPtr client)
ProcDPMSDispatch(ClientPtr client)
{
REQUEST(xReq);

switch (stuff->data)
{
switch (stuff->data) {
case X_DPMSGetVersion:
return ProcDPMSGetVersion(client);
return ProcDPMSGetVersion(client);
case X_DPMSCapable:
return ProcDPMSCapable(client);
return ProcDPMSCapable(client);
case X_DPMSGetTimeouts:
return ProcDPMSGetTimeouts(client);
return ProcDPMSGetTimeouts(client);
case X_DPMSSetTimeouts:
return ProcDPMSSetTimeouts(client);
return ProcDPMSSetTimeouts(client);
case X_DPMSEnable:
return ProcDPMSEnable(client);
return ProcDPMSEnable(client);
case X_DPMSDisable:
return ProcDPMSDisable(client);
return ProcDPMSDisable(client);
case X_DPMSForceLevel:
return ProcDPMSForceLevel(client);
return ProcDPMSForceLevel(client);
case X_DPMSInfo:
return ProcDPMSInfo(client);
return ProcDPMSInfo(client);
default:
return BadRequest;
return BadRequest;
}
}

Expand Down Expand Up @@ -332,36 +328,35 @@ SProcDPMSInfo(ClientPtr client)
}

static int
SProcDPMSDispatch (ClientPtr client)
SProcDPMSDispatch(ClientPtr client)
{
REQUEST(xReq);
switch (stuff->data)
{
switch (stuff->data) {
case X_DPMSGetVersion:
return SProcDPMSGetVersion(client);
return SProcDPMSGetVersion(client);
case X_DPMSCapable:
return SProcDPMSCapable(client);
return SProcDPMSCapable(client);
case X_DPMSGetTimeouts:
return SProcDPMSGetTimeouts(client);
return SProcDPMSGetTimeouts(client);
case X_DPMSSetTimeouts:
return SProcDPMSSetTimeouts(client);
return SProcDPMSSetTimeouts(client);
case X_DPMSEnable:
return SProcDPMSEnable(client);
return SProcDPMSEnable(client);
case X_DPMSDisable:
return SProcDPMSDisable(client);
return SProcDPMSDisable(client);
case X_DPMSForceLevel:
return SProcDPMSForceLevel(client);
return SProcDPMSForceLevel(client);
case X_DPMSInfo:
return SProcDPMSInfo(client);
return SProcDPMSInfo(client);
default:
return BadRequest;
return BadRequest;
}
}

void
DPMSExtensionInit(INITARGS)
{
AddExtension(DPMSExtensionName, 0, 0,
ProcDPMSDispatch, SProcDPMSDispatch,
NULL, StandardMinorOpcode);
ProcDPMSDispatch, SProcDPMSDispatch,
NULL, StandardMinorOpcode);
}
2 changes: 1 addition & 1 deletion Xext/dpmsproc.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "dixstruct.h"

int DPMSSet(ClientPtr client, int level);
int DPMSSet(ClientPtr client, int level);
Bool DPMSSupported(void);

#endif
6 changes: 4 additions & 2 deletions Xext/dpmsstubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ Equipment Corporation.

#define FALSE 0

Bool DPMSSupported(void)
Bool
DPMSSupported(void)
{
return FALSE;
}

int DPMSSet(ClientPtr client, int level)
int
DPMSSet(ClientPtr client, int level)
{
return Success;
}
Loading

0 comments on commit 9838b70

Please sign in to comment.