From 07eb361846dafca1d927145b9391c8c2b666880e Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 16 Jul 2025 12:02:01 +0200 Subject: [PATCH] dix: use NULL instead of NullClient No need to have another name for NULL, we can use NULL directly. Signed-off-by: Enrico Weigelt, metux IT consult --- dix/dispatch.c | 4 ++-- dix/dix_priv.h | 2 +- dix/dixfonts.c | 8 ++++---- dix/events.c | 10 +++++----- dix/gc.c | 6 +++--- dix/glyphcurs.c | 4 ++-- dix/lookup.c | 8 ++++---- dix/main.c | 2 +- dix/pixmap.c | 2 +- dix/resource_priv.h | 12 ++++++------ dix/selection.c | 6 +++--- dix/window.c | 2 +- 12 files changed, 33 insertions(+), 33 deletions(-) diff --git a/dix/dispatch.c b/dix/dispatch.c index 6a3ec0589..8c177cf59 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -3648,8 +3648,8 @@ CloseDownClient(ClientPtr client) #endif if (client->index < nextFreeClientID) nextFreeClientID = client->index; - clients[client->index] = NullClient; - SmartLastClient = NullClient; + clients[client->index] = NULL; + SmartLastClient = NULL; dixFreeObjectWithPrivates(client, PRIVATE_CLIENT); while (!clients[currentMaxClients - 1]) diff --git a/dix/dix_priv.h b/dix/dix_priv.h index c3dc45fac..a0843cdc6 100644 --- a/dix/dix_priv.h +++ b/dix/dix_priv.h @@ -686,7 +686,7 @@ static inline ClientPtr dixLookupXIDOwner(XID xid) int clientId = dixClientIdForXID(xid); if (clientId < currentMaxClients) return clients[clientId]; - return NullClient; + return NULL; } #endif /* _XSERVER_DIX_PRIV_H */ diff --git a/dix/dixfonts.c b/dix/dixfonts.c index 9f5e1f71f..82831af72 100644 --- a/dix/dixfonts.c +++ b/dix/dixfonts.c @@ -1189,7 +1189,7 @@ doPolyText(ClientPtr client, PTclosurePtr c) ChangeGCVal val; val.ptr = pFont; - ChangeGC(NullClient, c->pGC, GCFont, &val); + ChangeGC(NULL, c->pGC, GCFont, &val); ValidateGC(c->pDraw, c->pGC); } @@ -1330,7 +1330,7 @@ doPolyText(ClientPtr client, PTclosurePtr c) ChangeGCVal val; val.ptr = pFont; - ChangeGC(NullClient, origGC, GCFont, &val); + ChangeGC(NULL, origGC, GCFont, &val); ValidateGC(c->pDraw, origGC); } @@ -1349,7 +1349,7 @@ doPolyText(ClientPtr client, PTclosurePtr c) } if (ClientIsAsleep(client)) { ClientWakeup(c->client); - ChangeGC(NullClient, c->pGC, clearGCmask, clearGC); + ChangeGC(NULL, c->pGC, clearGCmask, clearGC); /* Unreference the font from the scratch GC */ CloseFont(c->pGC->font, (Font) 0); @@ -1498,7 +1498,7 @@ doImageText(ClientPtr client, ITclosurePtr c) } if (ClientIsAsleep(client)) { ClientWakeup(c->client); - ChangeGC(NullClient, c->pGC, clearGCmask, clearGC); + ChangeGC(NULL, c->pGC, clearGCmask, clearGC); /* Unreference the font from the scratch GC */ CloseFont(c->pGC->font, (Font) 0); diff --git a/dix/events.c b/dix/events.c index e18e24052..57d099e88 100644 --- a/dix/events.c +++ b/dix/events.c @@ -2359,7 +2359,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent *pEvents, size_t count, Mask filter, GrabPtr grab) { int deliveries = 0, nondeliveries = 0; - ClientPtr client = NullClient; + ClientPtr client = NULL; Mask deliveryMask = 0; /* If a grab occurs due to a button press, then this mask is the mask of the grab. */ int type = pEvents->u.u.type; @@ -2812,7 +2812,7 @@ DeliverEvent(DeviceIntPtr dev, xEvent *xE, int count, Mask filter; int deliveries = 0; - if (XaceHookSendAccess(NullClient, dev, win, xE, count) == Success) { + if (XaceHookSendAccess(NULL, dev, win, xE, count) == Success) { filter = GetEventFilter(dev, xE); FixUpEventFromWindow(pSprite, xE, win, child, FALSE); deliveries = DeliverEventsToWindow(dev, win, xE, count, filter, grab); @@ -4240,7 +4240,7 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window) rc = EventToXI(event, &xE, &count); if (rc == Success && - XaceHookSendAccess(NullClient, keybd, focus, xE, count) == Success) { + XaceHookSendAccess(NULL, keybd, focus, xE, count) == Success) { FixUpEventFromWindow(ptr->spriteInfo->sprite, xE, focus, None, FALSE); deliveries = DeliverEventsToWindow(keybd, focus, xE, count, GetEventFilter(keybd, xE), NullGrab); @@ -4256,7 +4256,7 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window) if (sendCore) { rc = EventToCore(event, &core, &count); if (rc == Success) { - if (XaceHookSendAccess(NullClient, keybd, focus, core, count) == + if (XaceHookSendAccess(NULL, keybd, focus, core, count) == Success) { FixUpEventFromWindow(keybd->spriteInfo->sprite, core, focus, None, FALSE); @@ -4329,7 +4329,7 @@ DeliverOneGrabbedEvent(InternalEvent *event, DeviceIntPtr dev, if (rc == Success) { FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE); - if (XaceHookSendAccess(NullClient, dev, grab->window, xE, count) || + if (XaceHookSendAccess(NULL, dev, grab->window, xE, count) || XaceHookReceiveAccess(dixClientForGrab(grab), grab->window, xE, count)) deliveries = 1; /* don't send, but pretend we did */ else if (level != CORE || !IsInterferingGrab(dixClientForGrab(grab), dev, xE)) { diff --git a/dix/gc.c b/dix/gc.c index 53888f514..1beb7a004 100644 --- a/dix/gc.c +++ b/dix/gc.c @@ -86,7 +86,7 @@ ValidateGC(DrawablePtr pDraw, GCPtr pGC) * The client performing the gc change must be passed so that access * checks can be performed on any tiles, stipples, or fonts that are * specified. ddxen can call this too; they should normally pass - * NullClient for the client since any access checking should have + * NULL for the client since any access checking should have * already been done at a higher level. * * If you have any XIDs, you must use ChangeGCXIDs: @@ -594,7 +594,7 @@ CreateDefaultTile(GCPtr pGC) tmpval[0].val = GXcopy; tmpval[1].val = pGC->tile.pixel; tmpval[2].val = FillSolid; - (void) ChangeGC(NullClient, pgcScratch, + (void) ChangeGC(NULL, pgcScratch, GCFunction | GCForeground | GCFillStyle, tmpval); ValidateGC((DrawablePtr) pTile, pgcScratch); rect.x = 0; @@ -886,7 +886,7 @@ CreateDefaultStipple(int screenNum) dixDestroyPixmap(pScreen->defaultStipple, 0); return FALSE; } - (void) ChangeGC(NullClient, pgcScratch, + (void) ChangeGC(NULL, pgcScratch, GCFunction | GCForeground | GCFillStyle, tmpval); ValidateGC((DrawablePtr) pScreen->defaultStipple, pgcScratch); rect.x = 0; diff --git a/dix/glyphcurs.c b/dix/glyphcurs.c index 5747d0b20..d71a9a405 100644 --- a/dix/glyphcurs.c +++ b/dix/glyphcurs.c @@ -112,13 +112,13 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, CursorMetricPtr cm, gcval[0].val = GXcopy; gcval[1].val = 0; gcval[2].ptr = (void *) pfont; - ChangeGC(NullClient, pGC, GCFunction | GCForeground | GCFont, gcval); + ChangeGC(NULL, pGC, GCFunction | GCForeground | GCFont, gcval); ValidateGC((DrawablePtr) ppix, pGC); (*pGC->ops->PolyFillRect) ((DrawablePtr) ppix, pGC, 1, &rect); /* draw the glyph */ gcval[0].val = 1; - ChangeGC(NullClient, pGC, GCForeground, gcval); + ChangeGC(NULL, pGC, GCForeground, gcval); ValidateGC((DrawablePtr) ppix, pGC); (*pGC->ops->PolyText16) ((DrawablePtr) ppix, pGC, cm->xhot, cm->yhot, 1, (unsigned short *) char2b); diff --git a/dix/lookup.c b/dix/lookup.c index 9418ac8f2..406f70264 100644 --- a/dix/lookup.c +++ b/dix/lookup.c @@ -14,28 +14,28 @@ ClientPtr dixClientForWindow(WindowPtr pWin) { if (!pWin) - return NullClient; + return NULL; return dixClientForXID(pWin->drawable.id); } ClientPtr dixClientForGrab(GrabPtr pGrab) { if (!pGrab) - return NullClient; + return NULL; return dixClientForXID(pGrab->resource); } ClientPtr dixClientForInputClients(InputClientsPtr pInputClients) { if (!pInputClients) - return NullClient; + return NULL; return dixClientForXID(pInputClients->resource); } ClientPtr dixClientForOtherClients(OtherClientsPtr pOtherClients) { if (!pOtherClients) - return NullClient; + return NULL; return dixClientForXID(pOtherClients->resource); } diff --git a/dix/main.c b/dix/main.c index d87bb2368..ed0c854f0 100644 --- a/dix/main.c +++ b/dix/main.c @@ -158,7 +158,7 @@ dix_main(int argc, char *argv[], char *envp[]) if (serverGeneration == 1) { CreateWellKnownSockets(); for (i = 1; i < LimitClients; i++) - clients[i] = NullClient; + clients[i] = NULL; serverClient = calloc(1, sizeof(ClientRec)); if (!serverClient) FatalError("couldn't create server client"); diff --git a/dix/pixmap.c b/dix/pixmap.c index f7812804a..bc3d83831 100644 --- a/dix/pixmap.c +++ b/dix/pixmap.c @@ -265,7 +265,7 @@ PixmapDirtyCopyArea(PixmapPtr dst, DrawablePtr src, ChangeGCVal subWindowMode; subWindowMode.val = IncludeInferiors; - ChangeGC(NullClient, pGC, GCSubwindowMode, &subWindowMode); + ChangeGC(NULL, pGC, GCSubwindowMode, &subWindowMode); } ValidateGC(&dst->drawable, pGC); diff --git a/dix/resource_priv.h b/dix/resource_priv.h index b8f8e638d..b2268f668 100644 --- a/dix/resource_priv.h +++ b/dix/resource_priv.h @@ -39,7 +39,7 @@ * (every client so is assigned a range of XIDs it may use for resource creation) * * @param WindowPtr to the window whose client shall be retrieved - * @return pointer to ClientRec structure or NullClient (NULL) + * @return pointer to ClientRec structure or NULL */ ClientPtr dixClientForWindow(WindowPtr pWin); @@ -50,7 +50,7 @@ ClientPtr dixClientForWindow(WindowPtr pWin); * (every client so is assigned a range of XIDs it may use for resource creation) * * @param GrabPtr to the grab whose owning client shall be retrieved - * @return pointer to ClientRec structure or NullClient (NULL) + * @return pointer to ClientRec structure or NULL */ ClientPtr dixClientForGrab(GrabPtr pGrab); @@ -61,7 +61,7 @@ ClientPtr dixClientForGrab(GrabPtr pGrab); * (every client so is assigned a range of XIDs it may use for resource creation) * * @param GrabPtr to the InputClients whose owning client shall be retrieved - * @return pointer to ClientRec structure or NullClient (NULL) + * @return pointer to ClientRec structure or NULL */ ClientPtr dixClientForInputClients(InputClientsPtr pInputClients); @@ -72,7 +72,7 @@ ClientPtr dixClientForInputClients(InputClientsPtr pInputClients); * (every client so is assigned a range of XIDs it may use for resource creation) * * @param GrabPtr to the OtherClients whose owning client shall be retrieved - * @return pointer to ClientRec structure or NullClient (NULL) + * @return pointer to ClientRec structure or NULL */ ClientPtr dixClientForOtherClients(OtherClientsPtr pOtherClients); @@ -98,13 +98,13 @@ static inline int dixClientIdForXID(XID xid) { * (every client so is assigned a range of XIDs it may use for resource creation) * * @param XID the ID of the resource whose client is retrieved - * @return pointer to ClientRec structure or NullClient (NULL) + * @return pointer to ClientRec structure or NULL */ static inline ClientPtr dixClientForXID(XID xid) { const int idx = dixClientIdForXID(xid); if (idx < MAXCLIENTS) return clients[idx]; - return NullClient; + return NULL; } /* diff --git a/dix/selection.c b/dix/selection.c index 92e66ee16..184ed178e 100644 --- a/dix/selection.c +++ b/dix/selection.c @@ -134,7 +134,7 @@ DeleteWindowFromAnySelections(WindowPtr pWin) pSel->pWin = (WindowPtr) NULL; pSel->window = None; - pSel->client = NullClient; + pSel->client = NULL; } } @@ -149,7 +149,7 @@ DeleteClientFromAnySelections(ClientPtr client) pSel->pWin = (WindowPtr) NULL; pSel->window = None; - pSel->client = NullClient; + pSel->client = NULL; } } @@ -235,7 +235,7 @@ ProcSetSelectionOwner(ClientPtr client) pSel->lastTimeChanged = time; pSel->window = param.owner; pSel->pWin = pWin; - pSel->client = (pWin ? client : NullClient); + pSel->client = (pWin ? client : NULL); CallSelectionCallback(pSel, client, SelectionSetOwner); return Success; diff --git a/dix/window.c b/dix/window.c index a75a7551d..38acaa16f 100644 --- a/dix/window.c +++ b/dix/window.c @@ -525,7 +525,7 @@ MakeRootTile(WindowPtr pWin) attributes[0].val = pScreen->whitePixel; attributes[1].val = pScreen->blackPixel; - (void) ChangeGC(NullClient, pGC, GCForeground | GCBackground, + (void) ChangeGC(NULL, pGC, GCForeground | GCBackground, attributes); }