summaryrefslogtreecommitdiffstats
path: root/tdm/backend/dpylist.c
diff options
context:
space:
mode:
Diffstat (limited to 'tdm/backend/dpylist.c')
-rw-r--r--tdm/backend/dpylist.c103
1 files changed, 61 insertions, 42 deletions
diff --git a/tdm/backend/dpylist.c b/tdm/backend/dpylist.c
index b512293f7..0119c12cb 100644
--- a/tdm/backend/dpylist.c
+++ b/tdm/backend/dpylist.c
@@ -64,12 +64,12 @@ AnyRunningDisplays( void )
for (d = displays; d; d = d->next)
switch (d->status) {
- case notRunning:
- case textMode:
- case reserve:
- break;
- default:
- return 1;
+ case notRunning:
+ case textMode:
+ case reserve:
+ break;
+ default:
+ return 1;
}
return 0;
}
@@ -79,9 +79,11 @@ AnyReserveDisplays( void )
{
struct display *d;
- for (d = displays; d; d = d->next)
- if ((d->displayType & d_lifetime) == dReserve)
+ for (d = displays; d; d = d->next) {
+ if ((d->displayType & d_lifetime) == dReserve) {
return 1;
+ }
+ }
return 0;
}
@@ -91,9 +93,11 @@ idleReserveDisplays( void )
struct display *d;
int cnt = 0;
- for (d = displays; d; d = d->next)
- if (d->status == reserve)
+ for (d = displays; d; d = d->next) {
+ if (d->status == reserve) {
cnt++;
+ }
+ }
return cnt;
}
@@ -102,9 +106,11 @@ StartReserveDisplay( int lt )
{
struct display *d, *rd;
- for (rd = 0, d = displays; d; d = d->next)
- if (d->status == reserve)
+ for (rd = 0, d = displays; d; d = d->next) {
+ if (d->status == reserve) {
rd = d;
+ }
+ }
if (rd) {
rd->idleTimeout = lt;
rd->status = notRunning;
@@ -129,8 +135,9 @@ static void
_forEachDisplayRev( struct display *d, void (*f)( struct display * ) )
{
if (d) {
- if (d->next)
- _forEachDisplayRev( d->next, f );
+ if (d->next) {
+ _forEachDisplayRev(d->next, f);
+ }
(*f)( d );
}
}
@@ -147,9 +154,11 @@ FindDisplayByName( const char *name )
{
struct display *d;
- for (d = displays; d; d = d->next)
- if (!strcmp( name, d->name ))
+ for (d = displays; d; d = d->next) {
+ if (!strcmp( name, d->name )) {
return d;
+ }
+ }
return 0;
}
@@ -158,9 +167,11 @@ FindDisplayByPid( int pid )
{
struct display *d;
- for (d = displays; d; d = d->next)
- if (pid == d->pid)
+ for (d = displays; d; d = d->next) {
+ if (pid == d->pid) {
return d;
+ }
+ }
return 0;
}
@@ -169,9 +180,11 @@ FindDisplayByServerPid( int serverPid )
{
struct display *d;
- for (d = displays; d; d = d->next)
- if (serverPid == d->serverPid)
+ for (d = displays; d; d = d->next) {
+ if (serverPid == d->serverPid) {
return d;
+ }
+ }
return 0;
}
@@ -182,9 +195,11 @@ FindDisplayBySessionID( CARD32 sessionID )
{
struct display *d;
- for (d = displays; d; d = d->next)
- if (sessionID == d->sessionID)
+ for (d = displays; d; d = d->next) {
+ if (sessionID == d->sessionID) {
return d;
+ }
+ }
return 0;
}
@@ -193,12 +208,14 @@ FindDisplayByAddress( XdmcpNetaddr addr, int addrlen, CARD16 displayNumber )
{
struct display *d;
- for (d = displays; d; d = d->next)
+ for (d = displays; d; d = d->next) {
if ((d->displayType & d_origin) == dFromXDMCP &&
d->displayNumber == displayNumber &&
addressEqual( (XdmcpNetaddr)d->from.data, d->from.length,
- addr, addrlen ))
+ addr, addrlen )) {
return d;
+ }
+ }
return 0;
}
@@ -207,37 +224,38 @@ FindDisplayByAddress( XdmcpNetaddr addr, int addrlen, CARD16 displayNumber )
#define IfFree(x) if (x) free( (char *)x )
void
-RemoveDisplay( struct display *old )
+RemoveDisplay(struct display *old)
{
struct display *d, **dp;
int i;
for (dp = &displays; (d = *dp); dp = &(*dp)->next) {
if (d == old) {
- Debug( "Removing display %s\n", d->name );
+ Debug("Removing display %s\n", d->name);
*dp = d->next;
- IfFree( d->class2 );
- IfFree( d->cfg.data );
- delStr( d->cfg.dep.name );
+ IfFree(d->class2);
+ IfFree(d->cfg.data);
+ delStr(d->cfg.dep.name);
#ifdef XDMCP
- IfFree( d->remoteHost );
+ IfFree(d->remoteHost);
#endif
if (d->authorizations) {
- for (i = 0; i < d->authNum; i++)
- XauDisposeAuth( d->authorizations[i] );
- free( (char *)d->authorizations );
+ for (i = 0; i < d->authNum; i++) {
+ XauDisposeAuth(d->authorizations[i]);
+ }
+ free((char *)d->authorizations);
}
if (d->authFile) {
- (void)unlink( d->authFile );
- free( d->authFile );
+ (void)unlink(d->authFile);
+ free(d->authFile);
}
- IfFree( d->authNameLens );
+ IfFree(d->authNameLens);
#ifdef XDMCP
- XdmcpDisposeARRAY8( &d->peer );
- XdmcpDisposeARRAY8( &d->from );
- XdmcpDisposeARRAY8( &d->clientAddr );
+ XdmcpDisposeARRAY8(&d->peer);
+ XdmcpDisposeARRAY8(&d->from);
+ XdmcpDisposeARRAY8(&d->clientAddr);
#endif
- free( (char *)d );
+ free((char *)d);
break;
}
}
@@ -270,8 +288,9 @@ NewDisplay( const char *name )
hstent->next = disphist; disphist = hstent;
}
- if (!(d = (struct display *)Calloc( 1, sizeof(*d) )))
+ if (!(d = (struct display *)Calloc( 1, sizeof(*d) ))) {
return 0;
+ }
d->next = displays;
d->hstent = hstent;
d->name = hstent->name;
@@ -289,6 +308,6 @@ NewDisplay( const char *name )
d->xdmcpFd = -1;
#endif
displays = d;
- Debug( "created new display %s\n", d->name );
+ Debug("created new display %s\n", d->name);
return d;
}