summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2015-03-21 13:42:12 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2015-04-21 16:57:08 -0700
commit1c56ac63c040280498c4a9d67b48c35b60070821 (patch)
treeab1073d348cb1acf0523ede3e1f2fa73f3b5fdb6 /render
parentb9e665c8b2f048feb3064ce412e0b3e9eb6797b0 (diff)
Convert top level extensions to new *allocarray functions
v2: remove now useless parentheses Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'render')
-rw-r--r--render/filter.c12
-rw-r--r--render/miindex.c2
-rw-r--r--render/mipict.c4
-rw-r--r--render/picture.c2
-rw-r--r--render/render.c6
5 files changed, 13 insertions, 13 deletions
diff --git a/render/filter.c b/render/filter.c
index 019ea7f94..2741f406c 100644
--- a/render/filter.c
+++ b/render/filter.c
@@ -67,7 +67,7 @@ PictureGetFilterId(const char *filter, int len, Bool makeit)
memcpy(name, filter, len);
name[len] = '\0';
if (filterNames)
- names = realloc(filterNames, (nfilterNames + 1) * sizeof(char *));
+ names = reallocarray(filterNames, nfilterNames + 1, sizeof(char *));
else
names = malloc(sizeof(char *));
if (!names) {
@@ -145,7 +145,7 @@ PictureAddFilter(ScreenPtr pScreen,
return -1;
if (ps->filters)
filters =
- realloc(ps->filters, (ps->nfilters + 1) * sizeof(PictFilterRec));
+ reallocarray(ps->filters, ps->nfilters + 1, sizeof(PictFilterRec));
else
filters = malloc(sizeof(PictFilterRec));
if (!filters)
@@ -177,9 +177,9 @@ PictureSetFilterAlias(ScreenPtr pScreen, const char *filter, const char *alias)
PictFilterAliasPtr aliases;
if (ps->filterAliases)
- aliases = realloc(ps->filterAliases,
- (ps->nfilterAliases + 1) *
- sizeof(PictFilterAliasRec));
+ aliases = reallocarray(ps->filterAliases,
+ ps->nfilterAliases + 1,
+ sizeof(PictFilterAliasRec));
else
aliases = malloc(sizeof(PictFilterAliasRec));
if (!aliases)
@@ -336,7 +336,7 @@ SetPicturePictFilter(PicturePtr pPicture, PictFilterPtr pFilter,
return BadMatch;
if (nparams != pPicture->filter_nparams) {
- xFixed *new_params = malloc(nparams * sizeof(xFixed));
+ xFixed *new_params = xallocarray(nparams, sizeof(xFixed));
if (!new_params && nparams)
return BadAlloc;
diff --git a/render/miindex.c b/render/miindex.c
index 0375e8f88..4119eef66 100644
--- a/render/miindex.c
+++ b/render/miindex.c
@@ -254,7 +254,7 @@ miInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat)
return FALSE;
pFormat->index.nvalues = num;
- pFormat->index.pValues = malloc(num * sizeof(xIndexValue));
+ pFormat->index.pValues = xallocarray(num, sizeof(xIndexValue));
if (!pFormat->index.pValues) {
free(pIndexed);
return FALSE;
diff --git a/render/mipict.c b/render/mipict.c
index a72510480..2571fda17 100644
--- a/render/mipict.c
+++ b/render/mipict.c
@@ -510,7 +510,7 @@ miTriStrip(CARD8 op,
int ntri;
ntri = npoints - 2;
- tris = malloc(ntri * sizeof(xTriangle));
+ tris = xallocarray(ntri, sizeof(xTriangle));
if (!tris)
return;
@@ -535,7 +535,7 @@ miTriFan(CARD8 op,
int ntri;
ntri = npoints - 2;
- tris = malloc(ntri * sizeof(xTriangle));
+ tris = xallocarray(ntri, sizeof(xTriangle));
if (!tris)
return;
diff --git a/render/picture.c b/render/picture.c
index 6ff31ba02..60517a4ee 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -837,7 +837,7 @@ initGradient(SourcePictPtr pGradient, int stopCount,
dpos = stopPoints[i];
}
- pGradient->gradient.stops = malloc(stopCount * sizeof(PictGradientStop));
+ pGradient->gradient.stops = xallocarray(stopCount, sizeof(PictGradientStop));
if (!pGradient->gradient.stops) {
*error = BadAlloc;
return;
diff --git a/render/render.c b/render/render.c
index 723f380c2..88d8a2669 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1318,14 +1318,14 @@ ProcRenderCompositeGlyphs(ClientPtr client)
if (nglyph <= NLOCALGLYPH)
glyphsBase = glyphsLocal;
else {
- glyphsBase = (GlyphPtr *) malloc(nglyph * sizeof(GlyphPtr));
+ glyphsBase = xallocarray(nglyph, sizeof(GlyphPtr));
if (!glyphsBase)
return BadAlloc;
}
if (nlist <= NLOCALDELTA)
listsBase = listsLocal;
else {
- listsBase = (GlyphListPtr) malloc(nlist * sizeof(GlyphListRec));
+ listsBase = xallocarray(nlist, sizeof(GlyphListRec));
if (!listsBase) {
rc = BadAlloc;
goto bail;
@@ -1793,7 +1793,7 @@ ProcRenderCreateAnimCursor(ClientPtr client)
ncursor =
(client->req_len -
(bytes_to_int32(sizeof(xRenderCreateAnimCursorReq)))) >> 1;
- cursors = malloc(ncursor * (sizeof(CursorPtr) + sizeof(CARD32)));
+ cursors = xallocarray(ncursor, sizeof(CursorPtr) + sizeof(CARD32));
if (!cursors)
return BadAlloc;
deltas = (CARD32 *) (cursors + ncursor);