summaryrefslogtreecommitdiff
path: root/dix/colormap.c
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2007-11-05 14:12:59 +0000
committerDaniel Stone <daniel@fooishbar.org>2007-11-05 14:34:43 +0000
commit914922fd6100a409a3dfd1c64511ed6bdc344bef (patch)
tree9d073014ac8bc779832aa98619ca54536927fa05 /dix/colormap.c
parent3b77689266e729411229ec83d2a90578ebc1d82f (diff)
DIX: Remove usage of alloca
Replace with heap allocations.
Diffstat (limited to 'dix/colormap.c')
-rw-r--r--dix/colormap.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/dix/colormap.c b/dix/colormap.c
index 73b666971..b27b8bc67 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -751,7 +751,7 @@ UpdateColors (ColormapPtr pmap)
pVisual = pmap->pVisual;
size = pVisual->ColormapEntries;
- defs = (xColorItem *)ALLOCATE_LOCAL(size * sizeof(xColorItem));
+ defs = (xColorItem *)xalloc(size * sizeof(xColorItem));
if (!defs)
return;
n = 0;
@@ -801,7 +801,7 @@ UpdateColors (ColormapPtr pmap)
}
if (n)
(*pmap->pScreen->StoreColors)(pmap, n, defs);
- DEALLOCATE_LOCAL(defs);
+ xfree(defs);
}
/* Get a read-only color from a ColorMap (probably slow for large maps)
@@ -1752,14 +1752,14 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
for(p = pixels; p < pixels + c; p++)
*p = 0;
- ppixRed = (Pixel *)ALLOCATE_LOCAL(npixR * sizeof(Pixel));
- ppixGreen = (Pixel *)ALLOCATE_LOCAL(npixG * sizeof(Pixel));
- ppixBlue = (Pixel *)ALLOCATE_LOCAL(npixB * sizeof(Pixel));
+ ppixRed = (Pixel *)xalloc(npixR * sizeof(Pixel));
+ ppixGreen = (Pixel *)xalloc(npixG * sizeof(Pixel));
+ ppixBlue = (Pixel *)xalloc(npixB * sizeof(Pixel));
if (!ppixRed || !ppixGreen || !ppixBlue)
{
- if (ppixBlue) DEALLOCATE_LOCAL(ppixBlue);
- if (ppixGreen) DEALLOCATE_LOCAL(ppixGreen);
- if (ppixRed) DEALLOCATE_LOCAL(ppixRed);
+ if (ppixBlue) xfree(ppixBlue);
+ if (ppixGreen) xfree(ppixGreen);
+ if (ppixRed) xfree(ppixRed);
return(BadAlloc);
}
@@ -1797,9 +1797,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
if (okB)
for(ppix = ppixBlue, npix = npixB; --npix >= 0; ppix++)
pmap->blue[*ppix].refcnt = 0;
- DEALLOCATE_LOCAL(ppixBlue);
- DEALLOCATE_LOCAL(ppixGreen);
- DEALLOCATE_LOCAL(ppixRed);
+ xfree(ppixBlue);
+ xfree(ppixGreen);
+ xfree(ppixRed);
return(BadAlloc);
}
@@ -1841,9 +1841,9 @@ AllocDirect (int client, ColormapPtr pmap, int c, int r, int g, int b, Bool cont
for (pDst = pixels; pDst < pixels + c; pDst++)
*pDst |= ALPHAMASK(pmap->pVisual);
- DEALLOCATE_LOCAL(ppixBlue);
- DEALLOCATE_LOCAL(ppixGreen);
- DEALLOCATE_LOCAL(ppixRed);
+ xfree(ppixBlue);
+ xfree(ppixGreen);
+ xfree(ppixRed);
return (Success);
}
@@ -1859,7 +1859,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig,
npix = c << r;
if ((r >= 32) || (npix > pmap->freeRed) || (npix < c))
return(BadAlloc);
- if(!(ppixTemp = (Pixel *)ALLOCATE_LOCAL(npix * sizeof(Pixel))))
+ if(!(ppixTemp = (Pixel *)xalloc(npix * sizeof(Pixel))))
return(BadAlloc);
ok = AllocCP(pmap, pmap->red, c, r, contig, ppixTemp, pmask);
@@ -1889,7 +1889,7 @@ AllocPseudo (int client, ColormapPtr pmap, int c, int r, Bool contig,
pmap->numPixelsRed[client] += npix;
pmap->freeRed -= npix;
}
- DEALLOCATE_LOCAL(ppixTemp);
+ xfree(ppixTemp);
return (ok ? Success : BadAlloc);
}
@@ -2089,7 +2089,7 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b,
npixClientNew = c << (r + g + b);
npixShared = (c << r) + (c << g) + (c << b);
- psharedList = (SHAREDCOLOR **)ALLOCATE_LOCAL(npixShared *
+ psharedList = (SHAREDCOLOR **)xalloc(npixShared *
sizeof(SHAREDCOLOR *));
if (!psharedList)
return FALSE;
@@ -2204,7 +2204,7 @@ AllocShared (ColormapPtr pmap, Pixel *ppix, int c, int r, int g, int b,
}
}
}
- DEALLOCATE_LOCAL(psharedList);
+ xfree(psharedList);
return TRUE;
}
@@ -2679,7 +2679,7 @@ IsMapInstalled(Colormap map, WindowPtr pWin)
Colormap *pmaps;
int imap, nummaps, found;
- pmaps = (Colormap *) ALLOCATE_LOCAL(
+ pmaps = (Colormap *) xalloc(
pWin->drawable.pScreen->maxInstalledCmaps * sizeof(Colormap));
if(!pmaps)
return(FALSE);
@@ -2694,6 +2694,6 @@ IsMapInstalled(Colormap map, WindowPtr pWin)
break;
}
}
- DEALLOCATE_LOCAL(pmaps);
+ xfree(pmaps);
return (found);
}