From 0bccfcc97b2300b83aa4693454c27ac87f23f221 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 9 Mar 2011 15:01:20 +1000 Subject: panoramiX: convert 0->panoramiXNumScreens loops to macro (v3) This just uses the FOR_NSCREENS macro instead. v2: remove some of the 1->x loops. v3: drop the 1->0 loop, will rework later. Signed-off-by: Dave Airlie Reviewed-by: Daniel Stone Reviewed-by: Alan Coopersmith --- Xext/panoramiX.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Xext/panoramiX.c') diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c index e6334bd93..d10af70c4 100644 --- a/Xext/panoramiX.c +++ b/Xext/panoramiX.c @@ -393,7 +393,7 @@ static void XineramaInitData(ScreenPtr pScreen) int i, w, h; RegionNull(&PanoramiXScreenRegion); - for (i = 0; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS(i) { BoxRec TheBox; RegionRec ScreenRegion; @@ -478,7 +478,7 @@ void PanoramiXExtensionInit(int argc, char *argv[]) * run in non-PanoramiXeen mode. */ - for (i = 0; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS(i) { pScreen = screenInfo.screens[i]; pScreenPriv = malloc(sizeof(PanoramiXScreenRec)); dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey, @@ -836,7 +836,7 @@ PanoramiXConsolidate(void) saver = malloc(sizeof(PanoramiXRes)); saver->type = XRT_WINDOW; - for (i = 0; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS(i) { ScreenPtr pScreen = screenInfo.screens[i]; root->info[i].id = pScreen->root->drawable.id; root->u.win.class = InputOutput; @@ -1074,7 +1074,7 @@ ProcXineramaQueryScreens(ClientPtr client) xXineramaScreenInfo scratch; int i; - for(i = 0; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS(i) { scratch.x_org = screenInfo.screens[i]->x; scratch.y_org = screenInfo.screens[i]->y; scratch.width = screenInfo.screens[i]->width; @@ -1179,7 +1179,7 @@ XineramaGetImageData( depth = (format == XYPixmap) ? 1 : pDraw->depth; - for(i = 0; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS(i) { BoxRec TheBox; ScreenPtr pScreen; pDraw = pDrawables[i]; -- cgit v1.2.3 From 5fb329a04a18835ce864d0563f6dfeb3d3c78d69 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 9 Mar 2011 15:05:26 +1000 Subject: panoramiX: convert 1->panoramiXNumScreens loops to use macro (v2) This converts all the remaining 1->num loops to the macro, this removes nearly all the panoramiXNumScreens usage in loops, and is a step to replacing it. v2: move some from the other patch. Signed-off-by: Dave Airlie Reviewed-by: Daniel Stone Reviewed-by: Alan Coopersmith --- Xext/panoramiX.c | 6 +++--- Xext/panoramiXprocs.c | 2 +- Xext/shm.c | 2 +- Xext/xvdisp.c | 2 +- dix/events.c | 6 +++--- hw/dmx/dmxgcops.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) (limited to 'Xext/panoramiX.c') diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c index d10af70c4..74241d8bc 100644 --- a/Xext/panoramiX.c +++ b/Xext/panoramiX.c @@ -413,7 +413,7 @@ static void XineramaInitData(ScreenPtr pScreen) PanoramiXPixWidth = screenInfo.screens[0]->x + screenInfo.screens[0]->width; PanoramiXPixHeight = screenInfo.screens[0]->y + screenInfo.screens[0]->height; - for (i = 1; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS_FORWARD_SKIP(i) { pScreen = screenInfo.screens[i]; w = pScreen->x + pScreen->width; h = pScreen->y + pScreen->height; @@ -740,7 +740,7 @@ PanoramiXMaybeAddDepth(DepthPtr pDepth) int j, k; Bool found = FALSE; - for (j = 1; j < PanoramiXNumScreens; j++) { + FOR_NSCREENS_FORWARD_SKIP(j) { pScreen = screenInfo.screens[j]; for (k = 0; k < pScreen->numDepths; k++) { if (pScreen->allowedDepths[k].depth == pDepth->depth) { @@ -773,7 +773,7 @@ PanoramiXMaybeAddVisual(VisualPtr pVisual) int j, k; Bool found = FALSE; - for (j = 1; j < PanoramiXNumScreens; j++) { + FOR_NSCREENS_FORWARD_SKIP(j) { pScreen = screenInfo.screens[j]; found = FALSE; diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index 4eb9a13c5..9ea461173 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -1840,7 +1840,7 @@ int PanoramiXGetImage(ClientPtr client) } drawables[0] = pDraw; - for(i = 1; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS_FORWARD_SKIP(i) { rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0, DixGetAttrAccess); if (rc != Success) diff --git a/Xext/shm.c b/Xext/shm.c index 62947206b..b08af821b 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -848,7 +848,7 @@ ProcPanoramiXShmGetImage(ClientPtr client) return BadAlloc; drawables[0] = pDraw; - for(i = 1; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS_FORWARD_SKIP(i) { rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0, DixReadAccess); if (rc != Success) diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c index beb26a973..b96843159 100644 --- a/Xext/xvdisp.c +++ b/Xext/xvdisp.c @@ -1918,7 +1918,7 @@ void XineramifyXv(void) MatchingAdaptors[0] = refAdapt; isOverlay = hasOverlay(refAdapt); - for(j = 1; j < PanoramiXNumScreens; j++) + FOR_NSCREENS_FORWARD_SKIP(j) MatchingAdaptors[j] = matchAdaptor(screenInfo.screens[j], refAdapt, isOverlay); /* now create a resource for each port */ diff --git a/dix/events.c b/dix/events.c index 5151f74ed..8835c5e61 100644 --- a/dix/events.c +++ b/dix/events.c @@ -2554,7 +2554,7 @@ PointInBorderSize(WindowPtr pWin, int x, int y) SpritePtr pSprite = inputInfo.pointer->spriteInfo->sprite; int i; - for(i = 1; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS_FORWARD_SKIP(i) { if(RegionContainsPoint(&pSprite->windows[i]->borderSize, x + screenInfo.screens[0]->x - screenInfo.screens[i]->x, y + screenInfo.screens[0]->y - screenInfo.screens[i]->y, @@ -3153,7 +3153,7 @@ XineramaPointInWindowIsVisible( xoff = x + screenInfo.screens[0]->x; yoff = y + screenInfo.screens[0]->y; - for(i = 1; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS_FORWARD_SKIP(i) { pWin = inputInfo.pointer->spriteInfo->sprite->windows[i]; x = xoff - screenInfo.screens[i]->x; y = yoff - screenInfo.screens[i]->y; @@ -3360,7 +3360,7 @@ BorderSizeNotEmpty(DeviceIntPtr pDev, WindowPtr pWin) if(!noPanoramiXExtension && XineramaSetWindowPntrs(pDev, pWin)) { int i; - for(i = 1; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS_FORWARD_SKIP(i) { if(RegionNotEmpty(&pDev->spriteInfo->sprite->windows[i]->borderSize)) return TRUE; } diff --git a/hw/dmx/dmxgcops.c b/hw/dmx/dmxgcops.c index bc8cd9edc..500e2cdf1 100644 --- a/hw/dmx/dmxgcops.c +++ b/hw/dmx/dmxgcops.c @@ -529,7 +529,7 @@ static DMXScreenInfo *dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw) NullClient, DixUnknownAccess)) return NULL; - for (i = 1; i < PanoramiXNumScreens; i++) { + FOR_NSCREENS_FORWARD_SKIP(i) { dmxScreen = &dmxScreens[i]; if (dmxScreen->beDisplay) { PixmapPtr pSrc; -- cgit v1.2.3