Commit ce40aec0 authored by Mike Gabriel's avatar Mike Gabriel

nx-X11/programs/Xserver: Drop {X,x}calloc() macros, use calloc() instead.

parent 74a5450b
......@@ -312,7 +312,7 @@
+ fprintf(stderr, "SocketCreateConnInfo: Going to create the NX connection info.\n");
+#endif
+
+ if ((ciptr = (XtransConnInfo) xcalloc (1, sizeof(struct _XtransConnInfo))) == NULL)
+ if ((ciptr = (XtransConnInfo) calloc (1, sizeof(struct _XtransConnInfo))) == NULL)
+ {
+ PRMSG (1, "SocketCreateConnInfo: malloc failed\n", 0, 0, 0);
+ return NULL;
......
......@@ -565,7 +565,7 @@ diff -u ./nx-X11/programs/Xserver/randr.X.original/randr.c ./nx-X11/programs/Xse
+ return FALSE;
- pScrPriv = (rrScrPrivPtr) xalloc (sizeof (rrScrPrivRec));
+ pScrPriv = (rrScrPrivPtr) xcalloc (1, sizeof (rrScrPrivRec));
+ pScrPriv = (rrScrPrivPtr) calloc (1, sizeof (rrScrPrivRec));
if (!pScrPriv)
return FALSE;
......
......@@ -187,7 +187,7 @@ TRANS(DNETOpenCOTSClient) (Xtransport *thistrans, char *protocol,
PRMSG (2,"DNETOpenCOTSClient(%s,%s,%s)\n", protocol, host, port);
if ((ciptr = (XtransConnInfo) xcalloc (
if ((ciptr = (XtransConnInfo) calloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
{
PRMSG (1, "DNETOpenCOTSClient: malloc failed\n", 0, 0, 0);
......@@ -215,7 +215,7 @@ TRANS(DNETOpenCOTSServer) (Xtransport *thistrans, char *protocol,
PRMSG (2,"DNETOpenCOTSServer(%s,%s,%s)\n", protocol, host, port);
if ((ciptr = (XtransConnInfo) xcalloc (
if ((ciptr = (XtransConnInfo) calloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
{
PRMSG (1, "DNETOpenCOTSServer: malloc failed\n", 0, 0, 0);
......@@ -247,7 +247,7 @@ TRANS(DNETOpenCLTSClient) (Xtransport *thistrans, char *protocol,
PRMSG (2,"DNETOpenCLTSClient(%s,%s,%s)\n", protocol, host, port);
if ((ciptr = (XtransConnInfo) xcalloc (
if ((ciptr = (XtransConnInfo) calloc (
1, sizeof (struct _XtransConnInfo))) == NULL)
{
PRMSG (1, "DNETOpenCLTSClient: malloc failed\n", 0, 0, 0);
......@@ -290,7 +290,7 @@ TRANS(DNETReopenCOTSServer) (Xtransport *thistrans, int fd, char *port)
PRMSG (2,"DNETReopenCOTSServer(%d,%s)\n", fd, port, 0);
if ((ciptr = (XtransConnInfo) xcalloc (
if ((ciptr = (XtransConnInfo) calloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
{
PRMSG (1, "DNETReopenCOTSServer: malloc failed\n", 0, 0, 0);
......@@ -311,7 +311,7 @@ TRANS(DNETReopenCLTSServer) (Xtransport *thistrans, int fd, char *port)
PRMSG (2,"DNETReopenCLTSServer(%d,%s)\n", fd, port, 0);
if ((ciptr = (XtransConnInfo) xcalloc (
if ((ciptr = (XtransConnInfo) calloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
{
PRMSG (1, "DNETReopenCLTSServer: malloc failed\n", 0, 0, 0);
......@@ -393,7 +393,7 @@ TRANS(DNETAccept) (XtransConnInfo ciptr, int *status)
PRMSG (2, "DNETAccept(%x,%d)\n", ciptr, ciptr->fd, 0);
if ((newciptr = (XtransConnInfo) xcalloc(
if ((newciptr = (XtransConnInfo) calloc(
1, sizeof (struct _XtransConnInfo))) == NULL)
{
PRMSG (1, "DNETAccept: malloc failed\n", 0, 0, 0);
......
......@@ -2038,7 +2038,7 @@ TRANS(LocalOpenClient)(int type, char *protocol, char *host, char *port)
*/
#endif /* X11_t */
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
if( (ciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo))) == NULL )
{
PRMSG(1,"LocalOpenClient: calloc(1,%d) failed\n",
sizeof(struct _XtransConnInfo),0,0 );
......@@ -2113,7 +2113,7 @@ TRANS(LocalOpenServer)(int type, char *protocol, char *host, char *port)
*/
#endif /* X11_t */
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
if( (ciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo))) == NULL )
{
PRMSG(1,"LocalOpenServer: calloc(1,%d) failed\n",
sizeof(struct _XtransConnInfo),0,0 );
......@@ -2168,7 +2168,7 @@ TRANS(LocalReopenServer)(int type, int index, int fd, char *port)
PRMSG(2,"LocalReopenServer(%d,%d,%d)\n", type, index, fd);
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
if( (ciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo))) == NULL )
{
PRMSG(1,"LocalReopenServer: calloc(1,%d) failed\n",
sizeof(struct _XtransConnInfo),0,0 );
......@@ -2384,7 +2384,7 @@ TRANS(LocalAccept)(XtransConnInfo ciptr, int *status)
transptr=(LOCALtrans2dev *)ciptr->priv;
if( (newciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo)))==NULL )
if( (newciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo)))==NULL )
{
PRMSG(1,"LocalAccept: calloc(1,%d) failed\n",
sizeof(struct _XtransConnInfo),0,0 );
......
......@@ -90,7 +90,7 @@ TRANS(Os2OpenClient)(Xtransport *thistrans, char *protocol,
PRMSG(5, "Os2OpenClient: Creating pipe %s\n",pipename, 0,0 );
/* make a connection entry */
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL ) {
if( (ciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) {
PRMSG(1,"Os2OpenClient: calloc(1,%d) failed\n",
sizeof(struct _XtransConnInfo),0,0 );
return NULL;
......@@ -268,9 +268,9 @@ TRANS(Os2OpenServer)(Xtransport *thistrans, char *protocol,
PRMSG(2,"Os2OpenServer(%s,%s,%s)\n",protocol,host,port);
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
if( (ciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo))) == NULL )
{
PRMSG(1,"Os2OpenServer: xcalloc(1,%d) failed\n",
PRMSG(1,"Os2OpenServer: calloc(1,%d) failed\n",
sizeof(struct _XtransConnInfo),0,0 );
return NULL;
}
......@@ -432,9 +432,9 @@ TRANS(Os2ReopenCOTSServer)(Xtransport *thistrans, int fd, char *port)
PRMSG(2,"Os2ReopenCOTSServer(%d,%s)\n", fd, port, 0);
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
if( (ciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo))) == NULL )
{
PRMSG(1,"Os2ReopenCOTSServer: xcalloc(1,%d) failed\n",
PRMSG(1,"Os2ReopenCOTSServer: calloc(1,%d) failed\n",
sizeof(struct _XtransConnInfo),0,0 );
return NULL;
}
......@@ -508,9 +508,9 @@ TRANS(Os2Accept)(XtransConnInfo ciptr, int *status)
PRMSG(2,"Os2Accept(%x->%d)\n", ciptr, ciptr->fd,0);
if( (newciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo)))==NULL )
if( (newciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo)))==NULL )
{
PRMSG(1,"Os2Accept: xcalloc(1,%d) failed\n",
PRMSG(1,"Os2Accept: calloc(1,%d) failed\n",
sizeof(struct _XtransConnInfo),0,0 );
*status = TRANS_ACCEPT_BAD_MALLOC;
return NULL;
......
......@@ -601,7 +601,7 @@ static XtransConnInfo TRANS(SocketCreateConnInfo) ()
fprintf(stderr, "SocketCreateConnInfo: Going to create the NX connection info.\n");
#endif
if ((ciptr = (XtransConnInfo) xcalloc (1, sizeof(struct _XtransConnInfo))) == NULL)
if ((ciptr = (XtransConnInfo) calloc (1, sizeof(struct _XtransConnInfo))) == NULL)
{
PRMSG (1, "SocketCreateConnInfo: malloc failed\n", 0, 0, 0);
return NULL;
......@@ -653,7 +653,7 @@ static XtransConnInfo TRANS(SocketCreateConnInfo) ()
exit(1);
}
_NXProxyConnInfoTab[ciptr->fd] = (_NXProxyConnInfo *) xcalloc(1, sizeof(_NXProxyConnInfo));
_NXProxyConnInfoTab[ciptr->fd] = (_NXProxyConnInfo *) calloc(1, sizeof(_NXProxyConnInfo));
if (_NXProxyConnInfoTab[ciptr->fd] == NULL)
{
......@@ -1063,7 +1063,7 @@ TRANS(SocketOpen) (int i, int type)
return NULL;
#endif
if ((ciptr = (XtransConnInfo) xcalloc (
if ((ciptr = (XtransConnInfo) calloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
{
PRMSG (1, "SocketOpen: malloc failed\n", 0, 0, 0);
......@@ -1119,7 +1119,7 @@ TRANS(SocketReopen) (int i, int type, int fd, char *port)
PRMSG (3,"SocketReopen(%d,%d,%s)\n", type, fd, port);
if ((ciptr = (XtransConnInfo) xcalloc (
if ((ciptr = (XtransConnInfo) calloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
{
PRMSG (1, "SocketReopen: malloc failed\n", 0, 0, 0);
......@@ -1953,7 +1953,7 @@ TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status)
PRMSG (2, "SocketINETAccept(%p,%d)\n", ciptr, ciptr->fd, 0);
if ((newciptr = (XtransConnInfo) xcalloc (
if ((newciptr = (XtransConnInfo) calloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
{
PRMSG (1, "SocketINETAccept: malloc failed\n", 0, 0, 0);
......@@ -2036,7 +2036,7 @@ TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status)
PRMSG (2, "SocketUNIXAccept(%p,%d)\n", ciptr, ciptr->fd, 0);
if ((newciptr = (XtransConnInfo) xcalloc (
if ((newciptr = (XtransConnInfo) calloc (
1, sizeof(struct _XtransConnInfo))) == NULL)
{
PRMSG (1, "SocketUNIXAccept: malloc() failed\n", 0, 0, 0);
......
......@@ -320,7 +320,7 @@ TRANS(TLIOpen)(char *device)
PRMSG(3,"TLIOpen(%s)\n", device, 0,0 );
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
if( (ciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo))) == NULL )
{
PRMSG(1, "TLIOpen: calloc failed\n", 0,0,0 );
return NULL;
......@@ -353,7 +353,7 @@ TRANS(TLIReopen)(char *device, int fd, char *port)
return NULL;
}
if( (ciptr=(XtransConnInfo)xcalloc(1,sizeof(struct _XtransConnInfo))) == NULL )
if( (ciptr=(XtransConnInfo)calloc(1,sizeof(struct _XtransConnInfo))) == NULL )
{
PRMSG(1, "TLIReopen: calloc failed\n", 0,0,0 );
return NULL;
......
......@@ -59,7 +59,6 @@ from The Open Group.
#include "os.h"
#else
#include <stdlib.h>
#define xcalloc(_num,_size) calloc(_num,_size)
#endif
#include "Xtransint.h"
......
......@@ -525,7 +525,7 @@ void PanoramiXExtensionInit(int argc, char *argv[])
*/
panoramiXdataPtr = (PanoramiXData *)
xcalloc(PanoramiXNumScreens, sizeof(PanoramiXData));
calloc(PanoramiXNumScreens, sizeof(PanoramiXData));
BREAK_IF(!panoramiXdataPtr);
BREAK_IF((PanoramiXGCIndex = AllocateGCPrivateIndex()) < 0);
......@@ -769,16 +769,16 @@ void PanoramiXConsolidate(void)
Bool foundDepth, missingDepth;
if(!PanoramiXVisualTable)
PanoramiXVisualTable = xcalloc(256 * MAXSCREENS, sizeof(XID));
PanoramiXVisualTable = calloc(256 * MAXSCREENS, sizeof(XID));
pScreen = screenInfo.screens[0];
pVisual = pScreen->visuals;
pDepth = pScreen->allowedDepths;
PanoramiXNumDepths = 0;
PanoramiXDepths = xcalloc(pScreen->numDepths,sizeof(DepthRec));
PanoramiXDepths = calloc(pScreen->numDepths,sizeof(DepthRec));
PanoramiXNumVisuals = 0;
PanoramiXVisuals = xcalloc(pScreen->numVisuals,sizeof(VisualRec));
PanoramiXVisuals = calloc(pScreen->numVisuals,sizeof(VisualRec));
for (i = 0; i < pScreen->numDepths; i++, pDepth++) {
missingDepth = FALSE;
......
......@@ -1036,7 +1036,7 @@ int PanoramiXCopyArea(ClientPtr client)
VERIFY_DRAWABLE(drawables[j], src->info[j].id, client);
pitch = PixmapBytePad(stuff->width, drawables[0]->depth);
if(!(data = xcalloc(1, stuff->height * pitch)))
if(!(data = calloc(1, stuff->height * pitch)))
return BadAlloc;
XineramaGetImageData(drawables, srcx, srcy,
......
......@@ -129,7 +129,7 @@ ProcXListInputDevices (client)
SizeDeviceInfo (d, &namesize, &size);
total_length = numdevs * sizeof (xDeviceInfo) + size + namesize;
devbuf = (char *) xcalloc (1, total_length);
devbuf = (char *) calloc (1, total_length);
classbuf = devbuf + (numdevs * sizeof (xDeviceInfo));
namebuf = classbuf + size;
savbuf = devbuf;
......
......@@ -1874,7 +1874,7 @@ DbeExtensionInit()
if (!AllocateWindowPrivate(pScreen, dbeWindowPrivIndex, 0) ||
!(pDbeScreenPriv =
(DbeScreenPrivPtr)Xcalloc(sizeof(DbeScreenPrivRec))))
(DbeScreenPrivPtr)calloc(1, sizeof(DbeScreenPrivRec))))
{
/* If we can not alloc a window or screen private,
* then free any privates that we already alloc'ed and return
......
......@@ -395,7 +395,7 @@ CreateColormap (Colormap mid, ScreenPtr pScreen, VisualPtr pVisual,
pmap->devPrivates = NULL;
else
{
pmap->devPrivates = (DevUnion *) xcalloc (
pmap->devPrivates = (DevUnion *) calloc (
sizeof(DevUnion), colormapPrivateCount);
if (!pmap->devPrivates)
{
......
......@@ -2188,7 +2188,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable,
xgi.length = length;
if (im_return) {
pBuf = (char *)xcalloc(1, sz_xGetImageReply + length);
pBuf = (char *)calloc(1, sz_xGetImageReply + length);
if (!pBuf)
return (BadAlloc);
if (widthBytesLine == 0)
......
......@@ -689,11 +689,11 @@ AddScreen(
if (i == MAXSCREENS)
return -1;
pScreen = (ScreenPtr) xcalloc(1, sizeof(ScreenRec));
pScreen = (ScreenPtr) calloc(1, sizeof(ScreenRec));
if (!pScreen)
return -1;
pScreen->devPrivates = (DevUnion *)xcalloc(sizeof(DevUnion),
pScreen->devPrivates = (DevUnion *)calloc(sizeof(DevUnion),
screenPrivateCount);
if (!pScreen->devPrivates && screenPrivateCount)
{
......
......@@ -1150,7 +1150,7 @@ xxSetup(ScreenPtr pScreen, int myDepth, int baseDepth, char* addr, xxSyncFunc sy
pScrPriv->sync = sync;
pScreen->maxInstalledCmaps += MAX_NUM_XX_INSTALLED_CMAPS;
pScrPriv->InstalledCmaps = xcalloc(MAX_NUM_XX_INSTALLED_CMAPS,
pScrPriv->InstalledCmaps = calloc(MAX_NUM_XX_INSTALLED_CMAPS,
sizeof(ColormapPtr));
if (!pScrPriv->InstalledCmaps)
return FALSE;
......
......@@ -2243,11 +2243,11 @@ miInitializeBanking(
(sizeof(miBankGCRec) - sizeof(RegionPtr))))
return FALSE;
if (!(pScreenPriv = (miBankScreenPtr)Xcalloc(sizeof(miBankScreenRec))))
if (!(pScreenPriv = (miBankScreenPtr)calloc(1, sizeof(miBankScreenRec))))
return FALSE;
if (!(pScreenPriv->pBanks = /* Allocate and clear */
(RegionPtr *)Xcalloc(nBanks * sizeof(RegionPtr))))
(RegionPtr *)calloc(1, nBanks * sizeof(RegionPtr))))
{
free(pScreenPriv);
return FALSE;
......
......@@ -196,7 +196,7 @@ miOverlayCreateWindow(WindowPtr pWin)
pWinPriv->tree = NULL;
if(!pWin->parent || !((*pScreenPriv->InOverlay)(pWin))) {
if(!(pTree = (miOverlayTreePtr)xcalloc(1, sizeof(miOverlayTreeRec))))
if(!(pTree = (miOverlayTreePtr)calloc(1, sizeof(miOverlayTreeRec))))
return FALSE;
}
......
......@@ -321,7 +321,7 @@ RRScreenInit(ScreenPtr pScreen)
if (!RRInit())
return FALSE;
pScrPriv = (rrScrPrivPtr) xcalloc(1, sizeof(rrScrPrivRec));
pScrPriv = (rrScrPrivPtr) calloc(1, sizeof(rrScrPrivRec));
if (!pScrPriv)
return FALSE;
......
......@@ -95,7 +95,7 @@ RRCrtcCreate(ScreenPtr pScreen, void *devPrivate)
return FALSE;
pScrPriv->crtcs = crtcs;
crtc = xcalloc(1, sizeof(RRCrtcRec));
crtc = calloc(1, sizeof(RRCrtcRec));
if (!crtc)
return NULL;
crtc->id = FakeClientID(0);
......@@ -370,7 +370,7 @@ RRComputeContiguity(ScreenPtr pScreen)
Bool discontiguous = TRUE;
int i, n = pScrPriv->numCrtcs;
int *reachable = xcalloc(n, sizeof(int));
int *reachable = calloc(n, sizeof(int));
if (!reachable)
goto out;
......@@ -1673,7 +1673,7 @@ ProcRRGetCrtcTransform(ClientPtr client)
nextra = (transform_filter_length(pending) +
transform_filter_length(current));
reply = xcalloc(1, sizeof(xRRGetCrtcTransformReply) + nextra);
reply = calloc(1, sizeof(xRRGetCrtcTransformReply) + nextra);
if (!reply)
return BadAlloc;
......
......@@ -95,7 +95,7 @@ RRMonitorSetFromServer(RRCrtcPtr crtc, RRMonitorPtr monitor)
monitor->name = RRMonitorCrtcName(crtc);
monitor->pScreen = crtc->pScreen;
monitor->numOutputs = crtc->numOutputs;
monitor->outputs = xcalloc(crtc->numOutputs, sizeof(RRCrtc));
monitor->outputs = calloc(crtc->numOutputs, sizeof(RRCrtc));
if (!monitor->outputs)
return FALSE;
for (o = 0; o < crtc->numOutputs; o++)
......@@ -173,7 +173,7 @@ RRMonitorSetFromClient(RRMonitorPtr client_monitor, RRMonitorPtr monitor)
monitor->name = client_monitor->name;
monitor->pScreen = client_monitor->pScreen;
monitor->numOutputs = client_monitor->numOutputs;
monitor->outputs = xcalloc(client_monitor->numOutputs, sizeof(RROutput));
monitor->outputs = calloc(client_monitor->numOutputs, sizeof(RROutput));
if (!monitor->outputs && client_monitor->numOutputs)
return FALSE;
memcpy(monitor->outputs, client_monitor->outputs, client_monitor->numOutputs * sizeof(RROutput));
......@@ -216,7 +216,7 @@ RRMonitorInitList(ScreenPtr screen, RRMonitorListPtr mon_list, Bool get_active)
#endif
mon_list->num_crtcs = numCrtcs;
mon_list->server_crtc = xcalloc(numCrtcs * 2, sizeof(RRCrtcPtr));
mon_list->server_crtc = calloc(numCrtcs * 2, sizeof(RRCrtcPtr));
if (!mon_list->server_crtc)
return FALSE;
......@@ -321,7 +321,7 @@ RRMonitorMakeList(ScreenPtr screen, Bool get_active, RRMonitorPtr * monitors_ret
if (!RRMonitorInitList(screen, &list, get_active))
return FALSE;
monitors = xcalloc(list.num_client + list.num_server, sizeof(RRMonitorRec));
monitors = calloc(list.num_client + list.num_server, sizeof(RRMonitorRec));
if (!monitors) {
RRMonitorFiniList(&list);
return FALSE;
......@@ -409,7 +409,7 @@ RRMonitorAlloc(int noutput)
{
RRMonitorPtr monitor;
monitor = xcalloc(1, sizeof(RRMonitorRec) + noutput * sizeof(RROutput));
monitor = calloc(1, sizeof(RRMonitorRec) + noutput * sizeof(RROutput));
if (!monitor)
return NULL;
monitor->numOutputs = noutput;
......
......@@ -380,7 +380,7 @@ RRProviderCreate(ScreenPtr pScreen, const char *name,
pScrPriv = rrGetScrPriv(pScreen);
provider = xcalloc(1, sizeof(RRProviderRec) + nameLength + 1);
provider = calloc(1, sizeof(RRProviderRec) + nameLength + 1);
if (!provider)
return NULL;
......
......@@ -75,14 +75,6 @@ typedef unsigned short CARD16;
#define ALLOCATE_LOCAL malloc
#define DEALLOCATE_LOCAL free
void *Xcalloc(size)
int size;
{
void *p = malloc(size);
if (p) memset(p, 0, size);
return p;
}
#ifndef max
#define max(_a, _b) ( ((_a) > (_b)) ? (_a) : (_b) )
#endif
......@@ -258,7 +250,7 @@ BitVectorCreateSet(pIntervals, nIntervals, pMem, memsize)
}
else
{
pbvs = (BitVectorSetPtr)Xcalloc(memsize);
pbvs = (BitVectorSetPtr)calloc(1, memsize);
if (!pbvs) return NULL;
pbvs->baseSet.ops = &BitVectorSetOperations;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment