From 5c12c7ad53337c52d1b3af780ee89313b583bcfc Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 17 Jul 2024 16:14:33 +0200 Subject: [PATCH] Xext: vidmode: ProcVidModeSetGammaRamp() declare variables where needed Make the code a bit easier to understand by declaring the variables where they're first used instead of at the very top of the function. Signed-off-by: Enrico Weigelt, metux IT consult --- Xext/vidmode.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Xext/vidmode.c b/Xext/vidmode.c index 800e1585d..229b0e377 100644 --- a/Xext/vidmode.c +++ b/Xext/vidmode.c @@ -1542,27 +1542,23 @@ static int ProcVidModeGetGammaRamp(ClientPtr client) { CARD16 *ramp = NULL; - int length; size_t ramplen = 0; - ScreenPtr pScreen; - VidModePtr pVidMode; REQUEST(xXF86VidModeGetGammaRampReq); - REQUEST_SIZE_MATCH(xXF86VidModeGetGammaRampReq); if (stuff->screen >= screenInfo.numScreens) return BadValue; - pScreen = screenInfo.screens[stuff->screen]; + ScreenPtr pScreen = screenInfo.screens[stuff->screen]; - pVidMode = VidModeGetPtr(pScreen); + VidModePtr pVidMode = VidModeGetPtr(pScreen); if (pVidMode == NULL) return BadImplementation; if (stuff->size != pVidMode->GetGammaRampSize(pScreen)) return BadValue; - length = (stuff->size + 1) & ~1; + const int length = (stuff->size + 1) & ~1; if (stuff->size) { if (!(ramp = calloc(length, 3 * sizeof(CARD16))))