treewide: use helper dixGetScreenPtr() for retrieving ScreenPtr's

Instead of directly accessing the global screenInfo.screens[] array,
let everybody go through a little inline helper. This one also checks
for array bounds - if the screen doesn't exist, return NULL.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-08-11 09:53:01 +02:00
committed by Enrico Weigelt
parent d2fcf85214
commit 0fbb681fce
17 changed files with 168 additions and 123 deletions

View File

@@ -601,8 +601,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE };
for (int i = 0; i < count; i++) {
ScreenPtr pScreen = (stuff->n == 0) ? screenInfo.screens[i] :
pDrawables[i]->pScreen;
ScreenPtr pScreen = (stuff->n == 0) ? dixGetScreenPtr(i) : pDrawables[i]->pScreen;
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
rc = dixCallScreenAccessCallback(client, pScreen, DixGetAttrAccess);
@@ -1033,7 +1032,7 @@ DbeExtensionInit(void)
*/
for (int j = 0; j < walkScreenIdx; j++) {
ScreenPtr pScreen = screenInfo.screens[j];
ScreenPtr pScreen = dixGetScreenPtr(j);
free(dixLookupPrivate(&pScreen->devPrivates, &dbeScreenPrivKeyRec));
dixSetPrivate(&pScreen->devPrivates, &dbeScreenPrivKeyRec, NULL);
}