Compare commits

...

1 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult 98c9f502a8 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>
2025-05-15 19:22:11 +02:00
3 changed files with 4 additions and 3 deletions

View File

@ -1491,13 +1491,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

@ -2722,7 +2722,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;