summaryrefslogtreecommitdiff
path: root/hw/dmx/glxProxy
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2008-10-06 15:36:51 -0400
committerAdam Jackson <ajax@redhat.com>2008-10-06 15:36:51 -0400
commit8a5b89e8e184f4cbf33c6dee0b06e61d8f857576 (patch)
treeb042833775d237a3971eae7a7192400e064ad50d /hw/dmx/glxProxy
parent0b7b89fbac0b3865b2cf51295c68a5f4c7523f28 (diff)
xalloc+memset(0) -> xcalloc
Diffstat (limited to 'hw/dmx/glxProxy')
-rw-r--r--hw/dmx/glxProxy/glxcmds.c3
-rw-r--r--hw/dmx/glxProxy/glxext.c13
-rw-r--r--hw/dmx/glxProxy/glxutil.c4
3 files changed, 6 insertions, 14 deletions
diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c
index a621542ca..536921a87 100644
--- a/hw/dmx/glxProxy/glxcmds.c
+++ b/hw/dmx/glxProxy/glxcmds.c
@@ -146,11 +146,10 @@ static int CreateContext(__GLXclientState *cl,
/*
** Allocate memory for the new context
*/
- glxc = (__GLXcontext *) __glXMalloc(sizeof(__GLXcontext));
+ glxc = __glXCalloc(1, sizeof(__GLXcontext));
if (!glxc) {
return BadAlloc;
}
- memset(glxc, 0, sizeof(__GLXcontext));
pScreen = screenInfo.screens[screen];
pGlxScreen = &__glXActiveScreens[screen];
diff --git a/hw/dmx/glxProxy/glxext.c b/hw/dmx/glxProxy/glxext.c
index 77dfeb205..3a2488132 100644
--- a/hw/dmx/glxProxy/glxext.c
+++ b/hw/dmx/glxProxy/glxext.c
@@ -419,19 +419,17 @@ static int __glXDispatch(ClientPtr client)
opcode = stuff->glxCode;
cl = __glXClients[client->index];
if (!cl) {
- cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState));
+ cl = __glXCalloc(1, sizeof(__GLXclientState));
__glXClients[client->index] = cl;
if (!cl) {
return BadAlloc;
}
- memset(cl, 0, sizeof(__GLXclientState));
- cl->be_displays = (Display **) __glXMalloc( screenInfo.numScreens * sizeof(Display *) );
+ cl->be_displays = __glXCalloc(screenInfo.numScreens, sizeof(Display *));
if (!cl->be_displays) {
__glXFree( cl );
return BadAlloc;
}
- memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *));
}
if (!cl->inUse) {
@@ -473,20 +471,17 @@ static int __glXSwapDispatch(ClientPtr client)
opcode = stuff->glxCode;
cl = __glXClients[client->index];
if (!cl) {
- cl = (__GLXclientState *) __glXMalloc(sizeof(__GLXclientState));
+ cl = __glXCalloc(1, sizeof(__GLXclientState));
__glXClients[client->index] = cl;
if (!cl) {
return BadAlloc;
}
- memset(cl, 0, sizeof(__GLXclientState));
- cl->be_displays = (Display **) __glXMalloc( screenInfo.numScreens * sizeof(Display *) );
+ cl->be_displays = __glXCalloc(screenInfo.numScreens, sizeof(Display *));
if (!cl->be_displays) {
__glXFree( cl );
return BadAlloc;
}
-
- memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *));
}
if (!cl->inUse) {
diff --git a/hw/dmx/glxProxy/glxutil.c b/hw/dmx/glxProxy/glxutil.c
index a7aedbedc..080992ea9 100644
--- a/hw/dmx/glxProxy/glxutil.c
+++ b/hw/dmx/glxProxy/glxutil.c
@@ -69,13 +69,11 @@ __glXCalloc(size_t numElements, size_t elementSize)
if ((numElements == 0) || (elementSize == 0)) {
return NULL;
}
- size = numElements * elementSize;
- addr = (void *) xalloc(size);
+ addr = xcalloc(numElements, elementSize);
if (addr == NULL) {
/* XXX: handle out of memory error */
return NULL;
}
- memset(addr, 0, size);
return addr;
}