From 1c8ef6d44d2fe87b0bda6334535ab21bc6bd6a38 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Wed, 12 Mar 2025 15:46:56 +0100 Subject: [PATCH] dix: colormap: let AllocColorCells() operate on ClientPtr instead of index It's only caller already has a pointer to client struct, so no need to let this function look it up again in the global clients array. Signed-off-by: Enrico Weigelt, metux IT consult --- dix/colormap.c | 3 ++- dix/colormap_priv.h | 2 +- dix/dispatch.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dix/colormap.c b/dix/colormap.c index a13538889..ab1dba79d 100644 --- a/dix/colormap.c +++ b/dix/colormap.c @@ -1485,13 +1485,14 @@ FreeClientPixels(void *value, XID fakeid) } int -AllocColorCells(int client, ColormapPtr pmap, int colors, int planes, +AllocColorCells(ClientPtr pClient, ColormapPtr pmap, int colors, int planes, Bool contig, Pixel * ppix, Pixel * masks) { Pixel rmask, gmask, bmask, *ppixFirst, r, g, b; int n, class; int ok; int oldcount; + const int client = pClient->index; colorResource *pcr = (colorResource *) NULL; class = pmap->class; diff --git a/dix/colormap_priv.h b/dix/colormap_priv.h index 04a55b07a..382f5aff5 100644 --- a/dix/colormap_priv.h +++ b/dix/colormap_priv.h @@ -46,7 +46,7 @@ int QueryColors(ColormapPtr pmap, int count, Pixel *ppixIn, /* should only be called via resource type's destructor */ int FreeClientPixels(void *pcr, XID fakeid); -int AllocColorCells(int client, ColormapPtr pmap, int colors, int planes, +int AllocColorCells(ClientPtr pClient, ColormapPtr pmap, int colors, int planes, Bool contig, Pixel *ppix, Pixel *masks); int AllocColorPlanes(int client, ColormapPtr pmap, int colors, int r, int g, diff --git a/dix/dispatch.c b/dix/dispatch.c index 0d7f98341..a5867d2d2 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -2707,7 +2707,7 @@ ProcAllocColorCells(ClientPtr client) return BadAlloc; pmasks = ppixels + npixels; - if ((rc = AllocColorCells(client->index, pcmp, npixels, nmasks, + if ((rc = AllocColorCells(client, pcmp, npixels, nmasks, (Bool) stuff->contiguous, ppixels, pmasks))) { free(ppixels); return rc;