summaryrefslogtreecommitdiff
path: root/dbe
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 /dbe
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 'dbe')
-rw-r--r--dbe/dbe.c14
-rw-r--r--dbe/midbe.c2
2 files changed, 7 insertions, 9 deletions
diff --git a/dbe/dbe.c b/dbe/dbe.c
index e5d928d7b..23f7e164d 100644
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -287,11 +287,10 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
}
/* malloc/realloc a new array and initialize all elements to 0. */
- pDbeWindowPriv->IDs = (XID *) realloc(pIDs,
- (pDbeWindowPriv->
- maxAvailableIDs +
- DBE_INCR_MAX_IDS) *
- sizeof(XID));
+ pDbeWindowPriv->IDs =
+ reallocarray(pIDs,
+ pDbeWindowPriv->maxAvailableIDs + DBE_INCR_MAX_IDS,
+ sizeof(XID));
if (!pDbeWindowPriv->IDs) {
return BadAlloc;
}
@@ -470,7 +469,7 @@ ProcDbeSwapBuffers(ClientPtr client)
dbeSwapInfo = (xDbeSwapInfo *) &stuff[1];
/* Allocate array to record swap information. */
- swapInfo = (DbeSwapInfoPtr) malloc(nStuff * sizeof(DbeSwapInfoRec));
+ swapInfo = xallocarray(nStuff, sizeof(DbeSwapInfoRec));
if (swapInfo == NULL) {
return BadAlloc;
}
@@ -580,8 +579,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
return BadAlloc;
/* Make sure any specified drawables are valid. */
if (stuff->n != 0) {
- if (!(pDrawables = (DrawablePtr *) malloc(stuff->n *
- sizeof(DrawablePtr)))) {
+ if (!(pDrawables = xallocarray(stuff->n, sizeof(DrawablePtr)))) {
return BadAlloc;
}
diff --git a/dbe/midbe.c b/dbe/midbe.c
index 8f759107a..9684d45bd 100644
--- a/dbe/midbe.c
+++ b/dbe/midbe.c
@@ -87,7 +87,7 @@ miDbeGetVisualInfo(ScreenPtr pScreen, XdbeScreenVisualInfo * pScrVisInfo)
}
/* Allocate an array of XdbeVisualInfo items. */
- if (!(visInfo = (XdbeVisualInfo *) malloc(count * sizeof(XdbeVisualInfo)))) {
+ if (!(visInfo = xallocarray(count, sizeof(XdbeVisualInfo)))) {
return FALSE; /* memory alloc failure */
}