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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-07-17 16:14:33 +02:00
parent 92ba36008e
commit 5c12c7ad53

View File

@ -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))))