mirror of
https://github.com/X11Libre/xserver.git
synced 2026-11-03 03:24:39 +00:00
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>
This commit is contained in:
parent
b9e665c8b2
commit
1c56ac63c0
34 changed files with 111 additions and 122 deletions
14
dbe/dbe.c
14
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue