From 80af3614d88c0cac160e787de7f34b37e96cb626 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 13 Oct 1999 18:49:47 +0000 Subject: [PATCH] now using MALLOC, CALLOC, FREE, etc macros --- src/mesa/drivers/glide/fxddtex.c | 14 +++++++------- src/mesa/drivers/glide/fxtexman.c | 16 ++++++++-------- src/mesa/drivers/glide/fxwgl.c | 10 +++++----- src/mesa/drivers/x11/fakeglx.c | 4 ++-- src/mesa/drivers/x11/xfonts.c | 4 ++-- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index c2004b76ae5..01994586856 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -52,7 +52,7 @@ static tfxTexInfo *fxAllocTexObjData(fxMesaContext fxMesa) tfxTexInfo *ti; int i; - if(!(ti=malloc(sizeof(tfxTexInfo)))) { + if(!(ti=MALLOC(sizeof(tfxTexInfo)))) { fprintf(stderr,"fx Driver: out of memory !\n"); fxCloseHardware(); exit(-1); @@ -276,7 +276,7 @@ void fxDDTexDel(GLcontext *ctx, struct gl_texture_object *tObj) fxTMFreeTexture(fxMesa,tObj); - free(ti); + FREE(ti); tObj->DriverData=NULL; ctx->NewState|=NEW_TEXTURING; @@ -833,7 +833,7 @@ static void fxTexBuildImageMap(const struct gl_texture_image *image, (*istranslate)=GL_TRUE; if(!(*dest)) { - if(!((*dest)=src=(unsigned short *)malloc(sizeof(unsigned char)*w*h))) { + if(!((*dest)=src=(unsigned short *)MALLOC(sizeof(unsigned char)*w*h))) { fprintf(stderr,"fx Driver: out of memory !\n"); fxCloseHardware(); exit(-1); @@ -861,7 +861,7 @@ static void fxTexBuildImageMap(const struct gl_texture_image *image, (*istranslate)=GL_TRUE; if(!(*dest)) { - if(!((*dest)=src=(unsigned short *)malloc(sizeof(unsigned short)*w*h))) { + if(!((*dest)=src=(unsigned short *)MALLOC(sizeof(unsigned short)*w*h))) { fprintf(stderr,"fx Driver: out of memory !\n"); fxCloseHardware(); exit(-1); @@ -905,7 +905,7 @@ static void fxTexBuildImageMap(const struct gl_texture_image *image, (*istranslate)=GL_TRUE; if(!(*dest)) { - if(!((*dest)=src=(unsigned short *)malloc(sizeof(unsigned short)*w*h))) { + if(!((*dest)=src=(unsigned short *)MALLOC(sizeof(unsigned short)*w*h))) { fprintf(stderr,"fx Driver: out of memory !\n"); fxCloseHardware(); exit(-1); @@ -955,7 +955,7 @@ static void fxTexBuildImageMap(const struct gl_texture_image *image, (*istranslate)=GL_TRUE; if(!(*dest)) { - if(!((*dest)=src=(unsigned short *)malloc(sizeof(unsigned short)*w*h))) { + if(!((*dest)=src=(unsigned short *)MALLOC(sizeof(unsigned short)*w*h))) { fprintf(stderr,"fx Driver: out of memory !\n"); fxCloseHardware(); exit(-1); @@ -1046,7 +1046,7 @@ void fxDDTexImg(GLcontext *ctx, GLenum target, return; } else { if(mml->translated) - free(mml->data); + FREE(mml->data); mml->data=NULL; } } diff --git a/src/mesa/drivers/glide/fxtexman.c b/src/mesa/drivers/glide/fxtexman.c index 5ee145e3cbf..3f899cbf5a8 100644 --- a/src/mesa/drivers/glide/fxtexman.c +++ b/src/mesa/drivers/glide/fxtexman.c @@ -34,7 +34,7 @@ static tfxTMFreeNode *fxTMNewTMFreeNode(FxU32 start, FxU32 end) { tfxTMFreeNode *tmn; - if(!(tmn=malloc(sizeof(tfxTMFreeNode)))) { + if(!(tmn=MALLOC(sizeof(tfxTMFreeNode)))) { fprintf(stderr,"fx Driver: out of memory !\n"); fxCloseHardware(); exit(-1); @@ -163,7 +163,7 @@ static tfxTMFreeNode *fxTMExtractTMFreeBlock(tfxTMFreeNode *tmfree, int texmemsi *startadr=tmfree->startAddress; nexttmfree=tmfree->next; - free(tmfree); + FREE(tmfree); return nexttmfree; } @@ -198,7 +198,7 @@ static tfxTMAllocNode *fxTMGetTMBlock(fxMesaContext fxMesa, struct gl_texture_ob fxMesa->freeTexMem[tmu]-=texmemsize; - if(!(newtmalloc=malloc(sizeof(tfxTMAllocNode)))) { + if(!(newtmalloc=MALLOC(sizeof(tfxTMAllocNode)))) { fprintf(stderr,"fx Driver: out of memory !\n"); fxCloseHardware(); exit(-1); @@ -413,7 +413,7 @@ static tfxTMAllocNode *fxTMFreeTMAllocBlock(tfxTMAllocNode *tmalloc, tfxTMAllocNode *newtmalloc; newtmalloc=tmalloc->next; - free(tmalloc); + FREE(tmalloc); return newtmalloc; } @@ -444,7 +444,7 @@ static tfxTMFreeNode *fxTMAddTMFree(tfxTMFreeNode *tmfree, FxU32 startadr, FxU32 tmfree->endAddress=tmfree->next->endAddress; nexttmfree=tmfree->next->next; - free(tmfree->next); + FREE(tmfree->next); tmfree->next=nexttmfree; } @@ -521,7 +521,7 @@ void fxTMFreeTexture(fxMesaContext fxMesa, struct gl_texture_object *tObj) for(i=0;itmi.mipmapLevel[i].used && ti->tmi.mipmapLevel[i].translated) - free(ti->tmi.mipmapLevel[i].data); + FREE(ti->tmi.mipmapLevel[i].data); (void)ti->tmi.mipmapLevel[i].data; } @@ -535,7 +535,7 @@ void fxTMFreeAllFreeNode(tfxTMFreeNode *fn) if(fn->next) fxTMFreeAllFreeNode(fn->next); - free(fn); + FREE(fn); } void fxTMFreeAllAllocNode(tfxTMAllocNode *an) @@ -546,7 +546,7 @@ void fxTMFreeAllAllocNode(tfxTMAllocNode *an) if(an->next) fxTMFreeAllAllocNode(an->next); - free(an); + FREE(an); } void fxTMClose(fxMesaContext fxMesa) diff --git a/src/mesa/drivers/glide/fxwgl.c b/src/mesa/drivers/glide/fxwgl.c index f7f4bdba515..3ba7f7a4b4d 100644 --- a/src/mesa/drivers/glide/fxwgl.c +++ b/src/mesa/drivers/glide/fxwgl.c @@ -351,7 +351,7 @@ HGLRC GLAPIENTRY wglCreateContext(HDC hdc) hDC = GetDC(dibWnd); - dibBMI = (BITMAPINFO*) malloc( sizeof(BITMAPINFO) + (256*sizeof(RGBQUAD))); + dibBMI = (BITMAPINFO*) MALLOC( sizeof(BITMAPINFO) + (256*sizeof(RGBQUAD))); memset(dibBMI,0,sizeof(BITMAPINFO) + (256*sizeof(RGBQUAD))); @@ -429,7 +429,7 @@ BOOL GLAPIENTRY wglDeleteContext(HGLRC hglrc) if(ctx && hglrc == (HGLRC)1) { if (gdiWindowHackEna) { DeleteObject(dibHBM); - free(dibBMI); + FREE(dibBMI); dibSurfacePtr = NULL; dibBMI = NULL; @@ -584,7 +584,7 @@ BOOL GLAPIENTRY wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChar // Convert the display dependant representation to a 1 bit deep DIB numBytes = (bmapWidth * bmapHeight) / 8; - bmap = malloc(numBytes); + bmap = MALLOC(numBytes); dibInfo->bmiHeader.biWidth = bmapWidth; dibInfo->bmiHeader.biHeight = bmapHeight; res = GetDIBits(bitDevice, bitObject, 0, bmapHeight, bmap, @@ -604,13 +604,13 @@ BOOL GLAPIENTRY wglUseFontBitmaps(HDC fontDevice, DWORD firstChar, DWORD numChar DeleteObject(bitObject); // Deallocate the bitmap data - free(bmap); + FREE(bmap); } // Destroy the DC VERIFY(DeleteDC(bitDevice)); - free(dibInfo); + FREE(dibInfo); return TRUE; #undef VERIFY diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index c15f1ef88d2..3dd0f6c2501 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -1,4 +1,4 @@ -/* $Id: fakeglx.c,v 1.8 1999/09/16 16:44:37 brianp Exp $ */ +/* $Id: fakeglx.c,v 1.9 1999/10/13 18:49:47 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -812,7 +812,7 @@ static XVisualInfo *choose_x_overlay_visual( Display *dpy, int scr, if (deepvis==NULL || vislist->depth > deepest) { /* YES! found a satisfactory visual */ if (deepvis) { - free( deepvis ); + XFree( deepvis ); } deepest = vislist->depth; deepvis = vislist; diff --git a/src/mesa/drivers/x11/xfonts.c b/src/mesa/drivers/x11/xfonts.c index c0e0a5fcd01..8745276123c 100644 --- a/src/mesa/drivers/x11/xfonts.c +++ b/src/mesa/drivers/x11/xfonts.c @@ -1,4 +1,4 @@ -/* $Id: xfonts.c,v 1.1 1999/08/19 00:55:42 jtg Exp $ */ +/* $Id: xfonts.c,v 1.2 1999/10/13 18:49:47 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -257,7 +257,7 @@ void Fake_glXUseXFont( Font font, int first, int count, int listbase ) max_bm_width = (max_width + 7) / 8; max_bm_height = max_height; - bm = (GLubyte *) malloc ((max_bm_width * max_bm_height) * sizeof + bm = (GLubyte *) MALLOC((max_bm_width * max_bm_height) * sizeof (GLubyte)); if (!bm) { XFreeFontInfo( NULL, fs, 0 ); -- 2.30.2