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 <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-03-12 15:46:56 +01:00
parent b9df6ed8a2
commit 1c8ef6d44d
3 changed files with 4 additions and 3 deletions

View File

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

View File

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

View File

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