randr: ProcRRGetCrtcInfo(): use locally scoped variables
Improve readability by moving the variables into local scopes. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1794>
This commit is contained in:
		
							parent
							
								
									7eff742ef2
								
							
						
					
					
						commit
						90abc95c85
					
				| 
						 | 
					@ -1148,28 +1148,19 @@ ProcRRGetCrtcInfo(ClientPtr client)
 | 
				
			||||||
    RRCrtcPtr crtc;
 | 
					    RRCrtcPtr crtc;
 | 
				
			||||||
    CARD8 *extra = NULL;
 | 
					    CARD8 *extra = NULL;
 | 
				
			||||||
    unsigned long extraLen = 0;
 | 
					    unsigned long extraLen = 0;
 | 
				
			||||||
    ScreenPtr pScreen;
 | 
					 | 
				
			||||||
    rrScrPrivPtr pScrPriv;
 | 
					 | 
				
			||||||
    RRModePtr mode;
 | 
					 | 
				
			||||||
    RROutput *outputs;
 | 
					 | 
				
			||||||
    RROutput *possible;
 | 
					 | 
				
			||||||
    int i, j, k;
 | 
					 | 
				
			||||||
    int width, height;
 | 
					 | 
				
			||||||
    BoxRec panned_area;
 | 
					 | 
				
			||||||
    Bool leased;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
 | 
					    REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq);
 | 
				
			||||||
    VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
 | 
					    VERIFY_RR_CRTC(stuff->crtc, crtc, DixReadAccess);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    leased = RRCrtcIsLeased(crtc);
 | 
					    Bool leased = RRCrtcIsLeased(crtc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* All crtcs must be associated with screens before client
 | 
					    /* All crtcs must be associated with screens before client
 | 
				
			||||||
     * requests are processed
 | 
					     * requests are processed
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    pScreen = crtc->pScreen;
 | 
					    ScreenPtr pScreen = crtc->pScreen;
 | 
				
			||||||
    pScrPriv = rrGetScrPriv(pScreen);
 | 
					    rrScrPrivPtr pScrPriv = rrGetScrPriv(pScreen);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    mode = crtc->mode;
 | 
					    RRModePtr mode = crtc->mode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xRRGetCrtcInfoReply rep = {
 | 
					    xRRGetCrtcInfoReply rep = {
 | 
				
			||||||
        .type = X_Reply,
 | 
					        .type = X_Reply,
 | 
				
			||||||
| 
						 | 
					@ -1183,6 +1174,7 @@ ProcRRGetCrtcInfo(ClientPtr client)
 | 
				
			||||||
        rep.rotation = RR_Rotate_0;
 | 
					        rep.rotation = RR_Rotate_0;
 | 
				
			||||||
        rep.rotations = RR_Rotate_0;
 | 
					        rep.rotations = RR_Rotate_0;
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
 | 
					        BoxRec panned_area;
 | 
				
			||||||
        if (pScrPriv->rrGetPanning &&
 | 
					        if (pScrPriv->rrGetPanning &&
 | 
				
			||||||
            pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) &&
 | 
					            pScrPriv->rrGetPanning(pScreen, crtc, &panned_area, NULL, NULL) &&
 | 
				
			||||||
            (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1))
 | 
					            (panned_area.x2 > panned_area.x1) && (panned_area.y2 > panned_area.y1))
 | 
				
			||||||
| 
						 | 
					@ -1193,6 +1185,7 @@ ProcRRGetCrtcInfo(ClientPtr client)
 | 
				
			||||||
            rep.height = panned_area.y2 - panned_area.y1;
 | 
					            rep.height = panned_area.y2 - panned_area.y1;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        else {
 | 
					        else {
 | 
				
			||||||
 | 
					            int width, height;
 | 
				
			||||||
            RRCrtcGetScanoutSize(crtc, &width, &height);
 | 
					            RRCrtcGetScanoutSize(crtc, &width, &height);
 | 
				
			||||||
            rep.x = crtc->x;
 | 
					            rep.x = crtc->x;
 | 
				
			||||||
            rep.y = crtc->y;
 | 
					            rep.y = crtc->y;
 | 
				
			||||||
| 
						 | 
					@ -1201,9 +1194,9 @@ ProcRRGetCrtcInfo(ClientPtr client)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        rep.mode = mode ? mode->mode.id : 0;
 | 
					        rep.mode = mode ? mode->mode.id : 0;
 | 
				
			||||||
        rep.nOutput = crtc->numOutputs;
 | 
					        rep.nOutput = crtc->numOutputs;
 | 
				
			||||||
        for (i = 0; i < pScrPriv->numOutputs; i++) {
 | 
					        for (int i = 0; i < pScrPriv->numOutputs; i++) {
 | 
				
			||||||
            if (!RROutputIsLeased(pScrPriv->outputs[i])) {
 | 
					            if (!RROutputIsLeased(pScrPriv->outputs[i])) {
 | 
				
			||||||
                for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)
 | 
					                for (int j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)
 | 
				
			||||||
                    if (pScrPriv->outputs[i]->crtcs[j] == crtc)
 | 
					                    if (pScrPriv->outputs[i]->crtcs[j] == crtc)
 | 
				
			||||||
                        rep.nPossibleOutput++;
 | 
					                        rep.nPossibleOutput++;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					@ -1218,18 +1211,19 @@ ProcRRGetCrtcInfo(ClientPtr client)
 | 
				
			||||||
                return BadAlloc;
 | 
					                return BadAlloc;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        outputs = (RROutput *) extra;
 | 
					        RROutput *outputs = (RROutput *) extra;
 | 
				
			||||||
        possible = (RROutput *) (outputs + rep.nOutput);
 | 
					        RROutput *possible = (RROutput *) (outputs + rep.nOutput);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (i = 0; i < crtc->numOutputs; i++) {
 | 
					        for (int i = 0; i < crtc->numOutputs; i++) {
 | 
				
			||||||
            outputs[i] = crtc->outputs[i]->id;
 | 
					            outputs[i] = crtc->outputs[i]->id;
 | 
				
			||||||
            if (client->swapped)
 | 
					            if (client->swapped)
 | 
				
			||||||
                swapl(&outputs[i]);
 | 
					                swapl(&outputs[i]);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        k = 0;
 | 
					
 | 
				
			||||||
        for (i = 0; i < pScrPriv->numOutputs; i++) {
 | 
					        int k = 0;
 | 
				
			||||||
 | 
					        for (int i = 0; i < pScrPriv->numOutputs; i++) {
 | 
				
			||||||
            if (!RROutputIsLeased(pScrPriv->outputs[i])) {
 | 
					            if (!RROutputIsLeased(pScrPriv->outputs[i])) {
 | 
				
			||||||
                for (j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)
 | 
					                for (int j = 0; j < pScrPriv->outputs[i]->numCrtcs; j++)
 | 
				
			||||||
                    if (pScrPriv->outputs[i]->crtcs[j] == crtc) {
 | 
					                    if (pScrPriv->outputs[i]->crtcs[j] == crtc) {
 | 
				
			||||||
                        possible[k] = pScrPriv->outputs[i]->id;
 | 
					                        possible[k] = pScrPriv->outputs[i]->id;
 | 
				
			||||||
                        if (client->swapped)
 | 
					                        if (client->swapped)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue