mi: miDCDeviceCleanup(): little loop simplification

skip cycle via `continue` instead of having a big if{} block.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-09-03 16:18:31 +02:00
committed by Enrico Weigelt
parent c339338277
commit 40473404e4

View File

@@ -491,24 +491,25 @@ miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
ScreenPtr walkScreen = screenInfo.screens[i];
miDCBufferPtr pBuffer = miGetDCDevice(pDev, walkScreen);
if (pBuffer) {
if (pBuffer->pSourceGC)
FreeGC(pBuffer->pSourceGC, (GContext) 0);
if (pBuffer->pMaskGC)
FreeGC(pBuffer->pMaskGC, (GContext) 0);
if (pBuffer->pSaveGC)
FreeGC(pBuffer->pSaveGC, (GContext) 0);
if (pBuffer->pRestoreGC)
FreeGC(pBuffer->pRestoreGC, (GContext) 0);
if (!pBuffer)
continue;
/* If a pRootPicture was allocated for a root window, it
* is freed when that root window is destroyed, so don't
* free it again here. */
if (pBuffer->pSourceGC)
FreeGC(pBuffer->pSourceGC, (GContext) 0);
if (pBuffer->pMaskGC)
FreeGC(pBuffer->pMaskGC, (GContext) 0);
if (pBuffer->pSaveGC)
FreeGC(pBuffer->pSaveGC, (GContext) 0);
if (pBuffer->pRestoreGC)
FreeGC(pBuffer->pRestoreGC, (GContext) 0);
dixDestroyPixmap(pBuffer->pSave, 0);
/* If a pRootPicture was allocated for a root window, it
* is freed when that root window is destroyed, so don't
* free it again here. */
free(pBuffer);
dixSetScreenPrivate(&pDev->devPrivates, miDCDeviceKey, walkScreen, NULL);
}
dixDestroyPixmap(pBuffer->pSave, 0);
free(pBuffer);
dixSetScreenPrivate(&pDev->devPrivates, miDCDeviceKey, walkScreen, NULL);
}
}