Replace _mesa_malloc, _mesa_calloc and _mesa_free with plain libc versions

This commit is contained in:
Kristian Høgsberg 2010-02-19 11:58:49 -05:00
parent 6bf1ea897f
commit 32f2fd1c5d
132 changed files with 624 additions and 691 deletions

View file

@ -812,7 +812,7 @@ __eglGetDrawableInfo(__DRInativeDisplay * ndpy, int screen, __DRIid drawable,
return GL_FALSE;
}
cliprect = (drm_clip_rect_t*) _mesa_malloc(sizeof(drm_clip_rect_t));
cliprect = (drm_clip_rect_t*) malloc(sizeof(drm_clip_rect_t));
cliprect->x1 = drawable->x;
cliprect->y1 = drawable->y;
cliprect->x2 = drawable->x + drawable->w;

View file

@ -1018,7 +1018,7 @@ glXChooseVisual( Display *dpy, int screen, int *list )
xmvis = choose_visual(dpy, screen, list, GL_FALSE);
if (xmvis) {
/* create a new vishandle - the cached one may be stale */
xmvis->vishandle = (XVisualInfo *) _mesa_malloc(sizeof(XVisualInfo));
xmvis->vishandle = (XVisualInfo *) malloc(sizeof(XVisualInfo));
if (xmvis->vishandle) {
memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
}
@ -1055,7 +1055,7 @@ glXCreateContext( Display *dpy, XVisualInfo *visinfo,
xmvis = create_glx_visual( dpy, visinfo );
if (!xmvis) {
/* unusable visual */
_mesa_free(glxCtx);
free(glxCtx);
return NULL;
}
}
@ -1063,7 +1063,7 @@ glXCreateContext( Display *dpy, XVisualInfo *visinfo,
glxCtx->xmesaContext = XMesaCreateContext(xmvis,
shareCtx ? shareCtx->xmesaContext : NULL);
if (!glxCtx->xmesaContext) {
_mesa_free(glxCtx);
free(glxCtx);
return NULL;
}
@ -1336,7 +1336,7 @@ glXDestroyContext( Display *dpy, GLXContext ctx )
MakeCurrent_PrevReadBuffer = 0;
XMesaDestroyContext( glxCtx->xmesaContext );
XMesaGarbageCollect();
_mesa_free(glxCtx);
free(glxCtx);
}
@ -1755,7 +1755,7 @@ glXGetFBConfigs( Display *dpy, int screen, int *nelements )
visuals = XGetVisualInfo(dpy, visMask, &visTemplate, nelements);
if (*nelements > 0) {
XMesaVisual *results;
results = (XMesaVisual *) _mesa_malloc(*nelements * sizeof(XMesaVisual));
results = (XMesaVisual *) malloc(*nelements * sizeof(XMesaVisual));
if (!results) {
*nelements = 0;
return NULL;
@ -1782,7 +1782,7 @@ glXChooseFBConfig( Display *dpy, int screen,
xmvis = choose_visual(dpy, screen, attribList, GL_TRUE);
if (xmvis) {
GLXFBConfig *config = (GLXFBConfig *) _mesa_malloc(sizeof(XMesaVisual));
GLXFBConfig *config = (GLXFBConfig *) malloc(sizeof(XMesaVisual));
if (!config) {
*nitems = 0;
return NULL;
@ -1807,7 +1807,7 @@ glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config )
return xmvis->vishandle;
#else
/* create a new vishandle - the cached one may be stale */
xmvis->vishandle = (XVisualInfo *) _mesa_malloc(sizeof(XVisualInfo));
xmvis->vishandle = (XVisualInfo *) malloc(sizeof(XVisualInfo));
if (xmvis->vishandle) {
memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
}
@ -2112,7 +2112,7 @@ glXCreateNewContext( Display *dpy, GLXFBConfig config,
glxCtx->xmesaContext = XMesaCreateContext(xmvis,
shareCtx ? shareCtx->xmesaContext : NULL);
if (!glxCtx->xmesaContext) {
_mesa_free(glxCtx);
free(glxCtx);
return NULL;
}
@ -2332,7 +2332,7 @@ glXCreateContextWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, int render_
glxCtx->xmesaContext = XMesaCreateContext(xmvis,
shareCtx ? shareCtx->xmesaContext : NULL);
if (!glxCtx->xmesaContext) {
_mesa_free(glxCtx);
free(glxCtx);
return NULL;
}

View file

@ -175,7 +175,7 @@ bits_per_pixel( XMesaVisual xmv )
/* grab the bits/pixel value */
bitsPerPixel = img->bits_per_pixel;
/* free the XImage */
_mesa_free( img->data );
free( img->data );
img->data = NULL;
XDestroyImage( img );
return bitsPerPixel;
@ -669,13 +669,13 @@ XMesaVisual XMesaCreateVisual( Display *display,
v->display = display;
/* Save a copy of the XVisualInfo struct because the user may X_mesa_free()
/* Save a copy of the XVisualInfo struct because the user may Xfree()
* the struct but we may need some of the information contained in it
* at a later time.
*/
v->visinfo = (XVisualInfo *) MALLOC(sizeof(*visinfo));
if (!v->visinfo) {
_mesa_free(v);
free(v);
return NULL;
}
memcpy(v->visinfo, visinfo, sizeof(*visinfo));
@ -743,8 +743,8 @@ XMesaVisual XMesaCreateVisual( Display *display,
PUBLIC
void XMesaDestroyVisual( XMesaVisual v )
{
_mesa_free(v->visinfo);
_mesa_free(v);
free(v->visinfo);
free(v);
}
@ -811,7 +811,7 @@ fail:
else if (pipe)
pipe->destroy(pipe);
_mesa_free(c);
free(c);
return NULL;
}
@ -828,7 +828,7 @@ void XMesaDestroyContext( XMesaContext c )
screen->destroy(screen);
*/
_mesa_free(c);
free(c);
}

View file

@ -31,39 +31,13 @@
* \author Ian Romanick <idr@us.ibm.com>
*/
#if defined(IN_MINI_GLX)
#include <GL/gl.h>
#else
#if defined(HAVE_DIX_CONFIG_H)
# include <dix-config.h>
#endif
#include <X11/X.h>
#include <GL/glx.h>
#include "GL/glxint.h"
#endif
/* Memory macros */
#if defined(IN_MINI_GLX)
# include <stdlib.h>
# include <string.h>
# define _mesa_malloc(b) malloc(b)
# define _mesa_free(m) free(m)
#else
# ifdef XFree86Server
# include <os.h>
# include <string.h>
# define _mesa_malloc(b) xalloc(b)
# define _mesa_free(m) xfree(m)
# else
# include <X11/Xlibint.h>
# define _mesa_malloc(b) Xmalloc(b)
# define _mesa_free(m) Xfree(m)
# endif /* XFree86Server */
#endif /* !defined(IN_MINI_GLX) */
#include <stdlib.h>
#include <string.h>
#include "glcontextmodes.h"
#if !defined(IN_MINI_GLX)
#define NUM_VISUAL_TYPES 6
/**
@ -352,7 +326,6 @@ _gl_get_context_mode_data(const __GLcontextModes * mode, int attribute,
return GLX_BAD_ATTRIBUTE;
}
}
#endif /* !defined(IN_MINI_GLX) */
/**
@ -392,7 +365,7 @@ _gl_context_modes_create(unsigned count, size_t minimum_size)
next = &base;
for (i = 0; i < count; i++) {
*next = (__GLcontextModes *) _mesa_malloc(size);
*next = (__GLcontextModes *) malloc(size);
if (*next == NULL) {
_gl_context_modes_destroy(base);
base = NULL;
@ -438,7 +411,7 @@ _gl_context_modes_destroy(__GLcontextModes * modes)
while (modes != NULL) {
__GLcontextModes *const next = modes->next;
_mesa_free(modes);
free(modes);
modes = next;
}
}

View file

@ -32,14 +32,12 @@
#include "GL/internal/glcore.h"
#if !defined(IN_MINI_GLX)
extern GLint _gl_convert_from_x_visual_type(int visualType);
extern GLint _gl_convert_to_x_visual_type(int visualType);
extern void _gl_copy_visual_to_context_mode(__GLcontextModes * mode,
const __GLXvisualConfig * config);
extern int _gl_get_context_mode_data(const __GLcontextModes * mode,
int attribute, int *value_return);
#endif /* !defined(IN_MINI_GLX) */
extern __GLcontextModes *_gl_context_modes_create(unsigned count,
size_t minimum_size);

View file

@ -307,7 +307,7 @@ _mesa_meta_free(GLcontext *ctx)
* freed by the normal context destruction code. But this would be
* the place to free other meta data someday.
*/
_mesa_free(ctx->Meta);
free(ctx->Meta);
ctx->Meta = NULL;
}
@ -1304,7 +1304,7 @@ _mesa_meta_BlitFramebuffer(GLcontext *ctx,
}
if (mask & GL_DEPTH_BUFFER_BIT) {
GLuint *tmp = (GLuint *) _mesa_malloc(srcW * srcH * sizeof(GLuint));
GLuint *tmp = (GLuint *) malloc(srcW * srcH * sizeof(GLuint));
if (tmp) {
if (!blit->DepthFP)
init_blit_depth_pixels(ctx);
@ -1328,7 +1328,7 @@ _mesa_meta_BlitFramebuffer(GLcontext *ctx,
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
mask &= ~GL_DEPTH_BUFFER_BIT;
_mesa_free(tmp);
free(tmp);
}
}
@ -2065,7 +2065,7 @@ _mesa_meta_Bitmap(GLcontext *ctx,
if (!bitmap1)
return;
bitmap8 = (GLubyte *) _mesa_calloc(width * height);
bitmap8 = (GLubyte *) calloc(1, width * height);
if (bitmap8) {
_mesa_expand_bitmap(width, height, &unpackSave, bitmap1,
bitmap8, width, 0xff);
@ -2082,7 +2082,7 @@ _mesa_meta_Bitmap(GLcontext *ctx,
_mesa_set_enable(ctx, tex->Target, GL_FALSE);
_mesa_free(bitmap8);
free(bitmap8);
}
_mesa_unmap_pbo_source(ctx, &unpackSave);
@ -2531,7 +2531,7 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
/*
* Alloc image buffer (XXX could use a PBO)
*/
buf = _mesa_malloc(width * height * bpp);
buf = malloc(width * height * bpp);
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD", dims);
return;
@ -2592,7 +2592,7 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
_mesa_lock_texture(ctx, texObj); /* re-lock */
_mesa_free(buf);
free(buf);
}
@ -2647,7 +2647,7 @@ copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
/*
* Alloc image buffer (XXX could use a PBO)
*/
buf = _mesa_malloc(width * height * bpp);
buf = malloc(width * height * bpp);
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage%uD", dims);
return;
@ -2688,7 +2688,7 @@ copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level,
_mesa_lock_texture(ctx, texObj); /* re-lock */
_mesa_free(buf);
free(buf);
}
@ -2731,7 +2731,7 @@ _mesa_meta_CopyColorTable(GLcontext *ctx,
{
GLfloat *buf;
buf = (GLfloat *) _mesa_malloc(width * 4 * sizeof(GLfloat));
buf = (GLfloat *) malloc(width * 4 * sizeof(GLfloat));
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyColorTable");
return;
@ -2748,7 +2748,7 @@ _mesa_meta_CopyColorTable(GLcontext *ctx,
_mesa_meta_end(ctx);
_mesa_free(buf);
free(buf);
}
@ -2758,7 +2758,7 @@ _mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start,
{
GLfloat *buf;
buf = (GLfloat *) _mesa_malloc(width * 4 * sizeof(GLfloat));
buf = (GLfloat *) malloc(width * 4 * sizeof(GLfloat));
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyColorSubTable");
return;
@ -2775,7 +2775,7 @@ _mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start,
_mesa_meta_end(ctx);
_mesa_free(buf);
free(buf);
}
@ -2786,7 +2786,7 @@ _mesa_meta_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target,
{
GLfloat *buf;
buf = (GLfloat *) _mesa_malloc(width * 4 * sizeof(GLfloat));
buf = (GLfloat *) malloc(width * 4 * sizeof(GLfloat));
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D");
return;
@ -2805,7 +2805,7 @@ _mesa_meta_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target,
_mesa_meta_end(ctx);
_mesa_free(buf);
free(buf);
}
@ -2816,7 +2816,7 @@ _mesa_meta_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target,
{
GLfloat *buf;
buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
if (!buf) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D");
return;
@ -2836,5 +2836,5 @@ _mesa_meta_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target,
_mesa_meta_end(ctx);
_mesa_free(buf);
free(buf);
}

View file

@ -242,12 +242,12 @@ __driUtilUpdateDrawableInfo(__DRIdrawable *pdp)
}
if (pdp->pClipRects) {
_mesa_free(pdp->pClipRects);
free(pdp->pClipRects);
pdp->pClipRects = NULL;
}
if (pdp->pBackClipRects) {
_mesa_free(pdp->pBackClipRects);
free(pdp->pBackClipRects);
pdp->pBackClipRects = NULL;
}
@ -324,7 +324,7 @@ static void driSwapBuffers(__DRIdrawable *dPriv)
if (!dPriv->numClipRects)
return;
rects = _mesa_malloc(sizeof(*rects) * dPriv->numClipRects);
rects = malloc(sizeof(*rects) * dPriv->numClipRects);
if (!rects)
return;
@ -337,7 +337,7 @@ static void driSwapBuffers(__DRIdrawable *dPriv)
}
driReportDamage(dPriv, rects, dPriv->numClipRects);
_mesa_free(rects);
free(rects);
}
static int driDrawableGetMSC( __DRIscreen *sPriv, __DRIdrawable *dPriv,
@ -430,7 +430,7 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config,
*/
(void) attrs;
pdp = _mesa_malloc(sizeof *pdp);
pdp = malloc(sizeof *pdp);
if (!pdp) {
return NULL;
}
@ -457,7 +457,7 @@ driCreateNewDrawable(__DRIscreen *psp, const __DRIconfig *config,
if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes,
renderType == GLX_PIXMAP_BIT)) {
_mesa_free(pdp);
free(pdp);
return NULL;
}
@ -510,14 +510,14 @@ static void dri_put_drawable(__DRIdrawable *pdp)
psp = pdp->driScreenPriv;
(*psp->DriverAPI.DestroyBuffer)(pdp);
if (pdp->pClipRects && pdp->pClipRects != &pdp->dri2.clipRect) {
_mesa_free(pdp->pClipRects);
free(pdp->pClipRects);
pdp->pClipRects = NULL;
}
if (pdp->pBackClipRects && pdp->pClipRects != &pdp->dri2.clipRect) {
_mesa_free(pdp->pBackClipRects);
free(pdp->pBackClipRects);
pdp->pBackClipRects = NULL;
}
_mesa_free(pdp);
free(pdp);
}
}
@ -547,7 +547,7 @@ driDestroyContext(__DRIcontext *pcp)
{
if (pcp) {
(*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp);
_mesa_free(pcp);
free(pcp);
}
}
@ -577,7 +577,7 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config,
__DRIcontext *pcp;
void * const shareCtx = (shared != NULL) ? shared->driverPrivate : NULL;
pcp = _mesa_malloc(sizeof *pcp);
pcp = malloc(sizeof *pcp);
if (!pcp)
return NULL;
@ -602,7 +602,7 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config,
pcp->hHWContext = hwContext;
if ( !(*psp->DriverAPI.CreateContext)(&config->modes, pcp, shareCtx) ) {
_mesa_free(pcp);
free(pcp);
return NULL;
}
@ -656,7 +656,7 @@ static void driDestroyScreen(__DRIscreen *psp)
(void)drmCloseOnce(psp->fd);
}
_mesa_free(psp);
free(psp);
}
}
@ -718,7 +718,7 @@ driCreateNewScreen(int scrn,
static const __DRIextension *emptyExtensionList[] = { NULL };
__DRIscreen *psp;
psp = _mesa_calloc(sizeof *psp);
psp = calloc(1, sizeof *psp);
if (!psp)
return NULL;
@ -763,7 +763,7 @@ driCreateNewScreen(int scrn,
*driver_modes = driDriverAPI.InitScreen(psp);
if (*driver_modes == NULL) {
_mesa_free(psp);
free(psp);
return NULL;
}
@ -785,7 +785,7 @@ dri2CreateNewScreen(int scrn, int fd,
if (driDriverAPI.InitScreen2 == NULL)
return NULL;
psp = _mesa_calloc(sizeof(*psp));
psp = calloc(1, sizeof(*psp));
if (!psp)
return NULL;
@ -807,7 +807,7 @@ dri2CreateNewScreen(int scrn, int fd,
psp->DriverAPI = driDriverAPI;
*driver_configs = driDriverAPI.InitScreen2(psp);
if (*driver_configs == NULL) {
_mesa_free(psp);
free(psp);
return NULL;
}

View file

@ -32,7 +32,7 @@ driDeleteRenderbuffer(struct gl_renderbuffer *rb)
/* don't free rb->Data Chances are it's a memory mapped region for
* the dri drivers.
*/
_mesa_free(rb);
free(rb);
}
@ -70,7 +70,7 @@ driNewRenderbuffer(gl_format format, GLvoid *addr,
assert(cpp > 0);
assert(pitch > 0);
drb = _mesa_calloc(sizeof(driRenderbuffer));
drb = calloc(1, sizeof(driRenderbuffer));
if (drb) {
const GLuint name = 0;

View file

@ -108,7 +108,7 @@ driGetRendererString( char * buffer, const char * hardware_name,
cpu = _mesa_get_cpu_string();
if (cpu) {
offset += sprintf(buffer + offset, " %s", cpu);
_mesa_free(cpu);
free(cpu);
}
return offset;
@ -559,7 +559,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
}
num_modes = num_depth_stencil_bits * num_db_modes * num_accum_bits * num_msaa_modes;
configs = _mesa_calloc((num_modes + 1) * sizeof *configs);
configs = calloc(1, (num_modes + 1) * sizeof *configs);
if (configs == NULL)
return NULL;
@ -568,7 +568,7 @@ driCreateConfigs(GLenum fb_format, GLenum fb_type,
for ( i = 0 ; i < num_db_modes ; i++ ) {
for ( h = 0 ; h < num_msaa_modes; h++ ) {
for ( j = 0 ; j < num_accum_bits ; j++ ) {
*c = _mesa_malloc (sizeof **c);
*c = malloc (sizeof **c);
modes = &(*c)->modes;
c++;
@ -653,7 +653,7 @@ __DRIconfig **driConcatConfigs(__DRIconfig **a,
while (b[j] != NULL)
j++;
all = _mesa_malloc((i + j + 1) * sizeof *all);
all = malloc((i + j + 1) * sizeof *all);
index = 0;
for (i = 0; a[i] != NULL; i++)
all[index++] = a[i];
@ -661,8 +661,8 @@ __DRIconfig **driConcatConfigs(__DRIconfig **a,
all[index++] = b[j];
all[index++] = NULL;
_mesa_free(a);
_mesa_free(b);
free(a);
free(b);
return all;
}

View file

@ -340,7 +340,7 @@ fbCreateContext( const __GLcontextModes *glVisual,
assert(driContextPriv);
/* Allocate the Fb context */
fbmesa = (fbContextPtr) _mesa_calloc( sizeof(*fbmesa) );
fbmesa = (fbContextPtr) calloc(1, sizeof(*fbmesa) );
if ( !fbmesa )
return GL_FALSE;
@ -358,7 +358,7 @@ fbCreateContext( const __GLcontextModes *glVisual,
ctx = fbmesa->glCtx = _mesa_create_context(glVisual, shareCtx,
&functions, (void *) fbmesa);
if (!fbmesa->glCtx) {
_mesa_free(fbmesa);
free(fbmesa);
return GL_FALSE;
}
driContextPriv->driverPrivate = fbmesa;
@ -406,7 +406,7 @@ fbDestroyContext( __DRIcontext *driContextPriv )
fbmesa->glCtx->DriverCtx = NULL;
_mesa_destroy_context( fbmesa->glCtx );
_mesa_free( fbmesa );
free( fbmesa );
}
}
@ -449,7 +449,7 @@ fbCreateBuffer( __DRIscreen *driScrnPriv,
}
if (mesaVis->doubleBufferMode) {
/* XXX what are the correct origin/stride values? */
GLvoid *backBuf = _mesa_malloc(driScrnPriv->fbStride
GLvoid *backBuf = malloc(driScrnPriv->fbStride
* driScrnPriv->fbHeight);
driRenderbuffer *drb = driNewRenderbuffer(MESA_FORMAT_ARGB8888,
backBuf,
@ -503,7 +503,7 @@ fbSwapBuffers( __DRIdrawable *dPriv )
if (ctx->Visual.doubleBufferMode) {
int i;
int offset = 0;
char *tmp = _mesa_malloc(currentPitch);
char *tmp = malloc(currentPitch);
_mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */
@ -516,7 +516,7 @@ fbSwapBuffers( __DRIdrawable *dPriv )
offset += currentPitch;
}
_mesa_free(tmp);
free(tmp);
}
}
else {

View file

@ -199,7 +199,7 @@ static void prepare_constant_buffer(struct brw_context *brw)
return;
}
buf = (GLfloat *) _mesa_calloc(bufsz);
buf = (GLfloat *) calloc(1, bufsz);
/* fragment shader constants */
if (brw->curbe.wm_size) {
@ -294,12 +294,12 @@ static void prepare_constant_buffer(struct brw_context *brw)
bufsz == brw->curbe.last_bufsz &&
memcmp(buf, brw->curbe.last_buf, bufsz) == 0) {
/* constants have not changed */
_mesa_free(buf);
free(buf);
}
else {
/* constants have changed */
if (brw->curbe.last_buf)
_mesa_free(brw->curbe.last_buf);
free(brw->curbe.last_buf);
brw->curbe.last_buf = buf;
brw->curbe.last_bufsz = bufsz;

View file

@ -320,7 +320,7 @@ copy_array_to_vbo_array( struct brw_context *brw,
} else {
void *data;
data = _mesa_malloc(dst_stride * element->count);
data = malloc(dst_stride * element->count);
dest = data;
for (i = 0; i < element->count; i++) {
memcpy(dest, src, dst_stride);
@ -333,7 +333,7 @@ copy_array_to_vbo_array( struct brw_context *brw,
size,
data);
_mesa_free(data);
free(data);
}
}
}

View file

@ -237,7 +237,7 @@ brw_resolve_cals(struct brw_compile *c)
struct brw_glsl_call *call, *next;
for (call = c->first_call; call; call = next) {
next = call->next;
_mesa_free(call);
free(call);
}
c->first_call = NULL;
}
@ -247,7 +247,7 @@ brw_resolve_cals(struct brw_compile *c)
struct brw_glsl_label *label, *next;
for (label = c->first_label; label; label = next) {
next = label->next;
_mesa_free(label);
free(label);
}
c->first_label = NULL;
}

View file

@ -73,7 +73,7 @@ brw_new_query_object(GLcontext *ctx, GLuint id)
{
struct brw_query_object *query;
query = _mesa_calloc(sizeof(struct brw_query_object));
query = calloc(1, sizeof(struct brw_query_object));
query->Base.Id = id;
query->Base.Result = 0;
@ -89,7 +89,7 @@ brw_delete_query(GLcontext *ctx, struct gl_query_object *q)
struct brw_query_object *query = (struct brw_query_object *)q;
dri_bo_unreference(query->bo);
_mesa_free(query);
free(query);
}
static void

View file

@ -57,8 +57,8 @@ GLboolean brw_cached_batch_struct( struct brw_context *brw,
if (item->sz == sz && memcmp(item->header, newheader, sz) == 0)
return GL_FALSE;
if (item->sz != sz) {
_mesa_free(item->header);
item->header = _mesa_malloc(sz);
free(item->header);
item->header = malloc(sz);
item->sz = sz;
}
goto emit;
@ -68,7 +68,7 @@ GLboolean brw_cached_batch_struct( struct brw_context *brw,
assert(!item);
item = CALLOC_STRUCT(brw_cached_batch_item);
item->header = _mesa_malloc(sz);
item->header = malloc(sz);
item->sz = sz;
item->next = brw->cached_batch_items;
brw->cached_batch_items = item;

View file

@ -150,7 +150,7 @@ rehash(struct brw_cache *cache)
GLuint size, i;
size = cache->size * 3;
items = (struct brw_cache_item**) _mesa_calloc(size * sizeof(*items));
items = (struct brw_cache_item**) calloc(1, size * sizeof(*items));
for (i = 0; i < cache->size; i++)
for (c = cache->items[i]; c; c = next) {
@ -237,7 +237,7 @@ brw_upload_cache_with_auxdata(struct brw_cache *cache,
/* Set up the memory containing the key, aux_data, and reloc_bufs */
tmp = _mesa_malloc(key_size + aux_size + relocs_size);
tmp = malloc(key_size + aux_size + relocs_size);
memcpy(tmp, key, key_size);
memcpy(tmp + key_size, aux, aux_size);
@ -366,7 +366,7 @@ brw_init_non_surface_cache(struct brw_context *brw)
cache->size = 7;
cache->n_items = 0;
cache->items = (struct brw_cache_item **)
_mesa_calloc(cache->size * sizeof(struct brw_cache_item));
calloc(1, cache->size * sizeof(struct brw_cache_item));
brw_init_cache_id(cache, "CC_VP", BRW_CC_VP);
brw_init_cache_id(cache, "CC_UNIT", BRW_CC_UNIT);
@ -403,7 +403,7 @@ brw_init_surface_cache(struct brw_context *brw)
cache->size = 7;
cache->n_items = 0;
cache->items = (struct brw_cache_item **)
_mesa_calloc(cache->size * sizeof(struct brw_cache_item));
calloc(1, cache->size * sizeof(struct brw_cache_item));
brw_init_cache_id(cache, "SS_SURFACE", BRW_SS_SURFACE);
brw_init_cache_id(cache, "SS_SURF_BIND", BRW_SS_SURF_BIND);
@ -444,7 +444,7 @@ brw_clear_cache(struct brw_context *brw, struct brw_cache *cache)
cache->n_items = 0;
if (brw->curbe.last_buf) {
_mesa_free(brw->curbe.last_buf);
free(brw->curbe.last_buf);
brw->curbe.last_buf = NULL;
}

View file

@ -67,11 +67,11 @@ static void brw_destroy_context( struct intel_context *intel )
brw_draw_destroy( brw );
brw_clear_validated_bos(brw);
if (brw->wm.compile_data) {
_mesa_free(brw->wm.compile_data->instruction);
_mesa_free(brw->wm.compile_data->vreg);
_mesa_free(brw->wm.compile_data->refs);
_mesa_free(brw->wm.compile_data->prog_instructions);
_mesa_free(brw->wm.compile_data);
free(brw->wm.compile_data->instruction);
free(brw->wm.compile_data->vreg);
free(brw->wm.compile_data->refs);
free(brw->wm.compile_data->prog_instructions);
free(brw->wm.compile_data);
}
for (i = 0; i < brw->state.nr_color_regions; i++)

View file

@ -151,11 +151,11 @@ static void do_wm_prog( struct brw_context *brw,
*/
return;
}
c->instruction = _mesa_calloc(BRW_WM_MAX_INSN * sizeof(*c->instruction));
c->prog_instructions = _mesa_calloc(BRW_WM_MAX_INSN *
c->instruction = calloc(1, BRW_WM_MAX_INSN * sizeof(*c->instruction));
c->prog_instructions = calloc(1, BRW_WM_MAX_INSN *
sizeof(*c->prog_instructions));
c->vreg = _mesa_calloc(BRW_WM_MAX_VREG * sizeof(*c->vreg));
c->refs = _mesa_calloc(BRW_WM_MAX_REF * sizeof(*c->refs));
c->vreg = calloc(1, BRW_WM_MAX_VREG * sizeof(*c->vreg));
c->refs = calloc(1, BRW_WM_MAX_REF * sizeof(*c->refs));
} else {
void *instruction = c->instruction;
void *prog_instructions = c->prog_instructions;

View file

@ -113,7 +113,7 @@ intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj)
if (obj->Pointer)
intel_bufferobj_unmap(ctx, 0, obj);
_mesa_free(intel_obj->sys_buffer);
free(intel_obj->sys_buffer);
if (intel_obj->region) {
intel_bufferobj_release_region(intel, intel_obj);
}
@ -121,7 +121,7 @@ intel_bufferobj_free(GLcontext * ctx, struct gl_buffer_object *obj)
dri_bo_unreference(intel_obj->buffer);
}
_mesa_free(intel_obj);
free(intel_obj);
}
@ -155,7 +155,7 @@ intel_bufferobj_data(GLcontext * ctx,
dri_bo_unreference(intel_obj->buffer);
intel_obj->buffer = NULL;
}
_mesa_free(intel_obj->sys_buffer);
free(intel_obj->sys_buffer);
intel_obj->sys_buffer = NULL;
if (size != 0) {
@ -164,7 +164,7 @@ intel_bufferobj_data(GLcontext * ctx,
* with their contents anyway.
*/
if (target == GL_ARRAY_BUFFER || target == GL_ELEMENT_ARRAY_BUFFER) {
intel_obj->sys_buffer = _mesa_malloc(size);
intel_obj->sys_buffer = malloc(size);
if (intel_obj->sys_buffer != NULL) {
if (data != NULL)
memcpy(intel_obj->sys_buffer, data, size);
@ -373,7 +373,7 @@ intel_bufferobj_map_range(GLcontext * ctx,
if ((access & GL_MAP_INVALIDATE_RANGE_BIT) &&
drm_intel_bo_busy(intel_obj->buffer)) {
if (access & GL_MAP_FLUSH_EXPLICIT_BIT) {
intel_obj->range_map_buffer = _mesa_malloc(length);
intel_obj->range_map_buffer = malloc(length);
obj->Pointer = intel_obj->range_map_buffer;
} else {
intel_obj->range_map_bo = drm_intel_bo_alloc(intel->bufmgr,
@ -523,7 +523,7 @@ intel_bufferobj_buffer(struct intel_context *intel,
intel_obj->Base.Size,
sys_buffer,
&intel_obj->Base);
_mesa_free(sys_buffer);
free(sys_buffer);
intel_obj->sys_buffer = NULL;
}

View file

@ -71,13 +71,13 @@ intel_delete_renderbuffer(struct gl_renderbuffer *rb)
ASSERT(irb);
if (irb->span_cache != NULL)
_mesa_free(irb->span_cache);
free(irb->span_cache);
if (intel && irb->region) {
intel_region_release(&irb->region);
}
_mesa_free(irb);
free(irb);
}
@ -316,7 +316,7 @@ intel_create_renderbuffer(gl_format format)
default:
_mesa_problem(NULL,
"Unexpected intFormat in intel_create_renderbuffer");
_mesa_free(irb);
free(irb);
return NULL;
}
@ -468,7 +468,7 @@ intel_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage)
irb->Base.ClassID = INTEL_RB_CLASS;
if (!intel_update_wrapper(ctx, irb, texImage)) {
_mesa_free(irb);
free(irb);
return NULL;
}

View file

@ -395,7 +395,7 @@ intel_texture_bitmap(GLcontext * ctx,
}
/* Convert the A1 bitmap to an A8 format suitable for glTexImage */
a8_bitmap = _mesa_calloc(width * height);
a8_bitmap = calloc(1, width * height);
_mesa_expand_bitmap(width, height, unpack, bitmap, a8_bitmap, width, 0xff);
if (_mesa_is_bufferobj(unpack->BufferObj)) {
@ -430,7 +430,7 @@ intel_texture_bitmap(GLcontext * ctx,
_mesa_PixelStorei(GL_UNPACK_ALIGNMENT, 1);
_mesa_TexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0,
GL_ALPHA, GL_UNSIGNED_BYTE, a8_bitmap);
_mesa_free(a8_bitmap);
free(a8_bitmap);
meta_set_fragment_program(&intel->meta, &intel->meta.bitmap_fp, fp);
_mesa_ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0,

View file

@ -147,7 +147,7 @@ intel_stencil_drawpixels(GLcontext * ctx,
/* Unpack the supplied stencil values into a ubyte buffer. */
assert(sizeof(GLstencil) == sizeof(GLubyte));
stencil_pixels = _mesa_malloc(width * height * sizeof(GLstencil));
stencil_pixels = malloc(width * height * sizeof(GLstencil));
for (row = 0; row < height; row++) {
GLvoid *source = _mesa_image_address2d(unpack, pixels,
width, height,
@ -201,7 +201,7 @@ intel_stencil_drawpixels(GLcontext * ctx,
_mesa_TexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY, width, height, 0,
GL_RED, GL_UNSIGNED_BYTE, stencil_pixels);
ctx->Unpack = old_unpack;
_mesa_free(stencil_pixels);
free(stencil_pixels);
meta_set_passthrough_transform(&intel->meta);

View file

@ -49,7 +49,7 @@ static void
get_span_cache(struct intel_renderbuffer *irb, uint32_t offset)
{
if (irb->span_cache == NULL) {
irb->span_cache = _mesa_malloc(SPAN_CACHE_SIZE);
irb->span_cache = malloc(SPAN_CACHE_SIZE);
irb->span_cache_offset = -1;
}

View file

@ -50,7 +50,7 @@ intel_new_sync_object(GLcontext *ctx, GLuint id)
{
struct intel_sync_object *sync;
sync = _mesa_calloc(sizeof(struct intel_sync_object));
sync = calloc(1, sizeof(struct intel_sync_object));
return &sync->Base;
}
@ -61,7 +61,7 @@ intel_delete_sync_object(GLcontext *ctx, struct gl_sync_object *s)
struct intel_sync_object *sync = (struct intel_sync_object *)s;
drm_intel_bo_unreference(sync->bo);
_mesa_free(sync);
free(sync);
}
static void

View file

@ -277,7 +277,7 @@ struct r300_fragment_program *r300SelectAndTranslateFragmentShader(GLcontext *ct
fp = fp->next;
}
fp = _mesa_calloc(sizeof(struct r300_fragment_program));
fp = calloc(1, sizeof(struct r300_fragment_program));
fp->state = state;

View file

@ -39,7 +39,7 @@ static void freeFragProgCache(GLcontext *ctx, struct r300_fragment_program_cont
while (fp) {
tmp = fp->next;
rc_constants_destroy(&fp->code.constants);
_mesa_free(fp);
free(fp);
fp = tmp;
}
}
@ -52,7 +52,7 @@ static void freeVertProgCache(GLcontext *ctx, struct r300_vertex_program_cont *c
tmp = vp->next;
rc_constants_destroy(&vp->code.constants);
_mesa_reference_vertprog(ctx, &vp->Base, NULL);
_mesa_free(vp);
free(vp);
vp = tmp;
}
}

View file

@ -233,7 +233,7 @@ static struct r300_vertex_program *build_program(GLcontext *ctx,
struct r300_vertex_program *vp;
struct r300_vertex_program_compiler compiler;
vp = _mesa_calloc(sizeof(*vp));
vp = calloc(1, sizeof(*vp));
vp->Base = _mesa_clone_vertex_program(ctx, mesa_vp);
memcpy(&vp->key, wanted_key, sizeof(vp->key));

View file

@ -53,7 +53,7 @@ static void freeVertProgCache(GLcontext *ctx, struct r700_vertex_program_cont *c
Clean_Up_Shader(&(vp->r700Shader));
_mesa_reference_vertprog(ctx, &vp->mesa_program, NULL);
_mesa_free(vp);
free(vp);
vp = tmp;
}
}

View file

@ -307,7 +307,7 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx,
struct r700_vertex_program *vp;
unsigned int i;
vp = _mesa_calloc(sizeof(*vp));
vp = calloc(1, sizeof(*vp));
vp->mesa_program = _mesa_clone_vertex_program(ctx, mesa_vp);
if (mesa_vp->IsPositionInvariant)

View file

@ -70,7 +70,7 @@ radeonDeleteBufferObject(GLcontext * ctx,
radeon_bo_unref(radeon_obj->bo);
}
_mesa_free(radeon_obj);
free(radeon_obj);
}

View file

@ -66,7 +66,7 @@ radeon_delete_renderbuffer(struct gl_renderbuffer *rb)
if (rrb && rrb->bo) {
radeon_bo_unref(rrb->bo);
}
_mesa_free(rrb);
free(rrb);
}
static void *
@ -511,7 +511,7 @@ radeon_wrap_texture(GLcontext * ctx, struct gl_texture_image *texImage)
rrb->base.ClassID = RADEON_RB_CLASS;
if (!radeon_update_wrapper(ctx, rrb, texImage)) {
_mesa_free(rrb);
free(rrb);
return NULL;
}

View file

@ -81,7 +81,7 @@ static struct gl_query_object * radeonNewQueryObject(GLcontext *ctx, GLuint id)
{
struct radeon_query_object *query;
query = _mesa_calloc(sizeof(struct radeon_query_object));
query = calloc(1, sizeof(struct radeon_query_object));
query->Base.Id = id;
query->Base.Result = 0;
@ -103,7 +103,7 @@ static void radeonDeleteQuery(GLcontext *ctx, struct gl_query_object *q)
radeon_bo_unref(query->bo);
}
_mesa_free(query);
free(query);
}
static void radeonWaitQuery(GLcontext *ctx, struct gl_query_object *q)

View file

@ -637,7 +637,7 @@ static GLuint * allocate_image_offsets(GLcontext *ctx,
int i;
GLuint *offsets;
offsets = _mesa_malloc(depth * sizeof(GLuint)) ;
offsets = malloc(depth * sizeof(GLuint)) ;
if (!offsets) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTex[Sub]Image");
return NULL;
@ -736,7 +736,7 @@ static void radeon_store_teximage(GLcontext* ctx, int dims,
}
if (dims == 3) {
_mesa_free(dstImageOffsets);
free(dstImageOffsets);
}
radeon_teximage_unmap(image);

View file

@ -179,7 +179,7 @@ savageInitDriver(__DRIscreen *sPriv)
}
/* Allocate the private area */
savageScreen = (savageScreenPrivate *)_mesa_malloc(sizeof(savageScreenPrivate));
savageScreen = (savageScreenPrivate *)malloc(sizeof(savageScreenPrivate));
if (!savageScreen)
return GL_FALSE;
@ -226,7 +226,7 @@ savageInitDriver(__DRIscreen *sPriv)
savageScreen->agpTextures.handle,
savageScreen->agpTextures.size,
(drmAddress *)&(savageScreen->agpTextures.map)) != 0) {
_mesa_free(savageScreen);
free(savageScreen);
sPriv->private = NULL;
return GL_FALSE;
}
@ -246,7 +246,7 @@ savageInitDriver(__DRIscreen *sPriv)
savageScreen->aperture.size,
(drmAddress *)&savageScreen->aperture.map) != 0)
{
_mesa_free(savageScreen);
free(savageScreen);
sPriv->private = NULL;
return GL_FALSE;
}
@ -282,7 +282,7 @@ savageDestroyScreen(__DRIscreen *sPriv)
/* free all option information */
driDestroyOptionInfo (&savageScreen->optionCache);
_mesa_free(savageScreen);
free(savageScreen);
sPriv->private = NULL;
}
@ -300,7 +300,7 @@ savageCreateContext( const __GLcontextModes *mesaVis,
savageScreen->sarea_priv_offset);
int textureSize[SAVAGE_NR_TEX_HEAPS];
int i;
imesa = (savageContextPtr)_mesa_calloc(sizeof(savageContext));
imesa = (savageContextPtr)calloc(1, sizeof(savageContext));
if (!imesa) {
return GL_FALSE;
}
@ -317,7 +317,7 @@ savageCreateContext( const __GLcontextModes *mesaVis,
shareCtx = NULL;
ctx = _mesa_create_context(mesaVis, shareCtx, &functions, imesa);
if (!ctx) {
_mesa_free(imesa);
free(imesa);
return GL_FALSE;
}
driContextPriv->driverPrivate = imesa;
@ -436,7 +436,7 @@ savageCreateContext( const __GLcontextModes *mesaVis,
if (ctx->Const.MaxTextureLevels <= 6) { /*spec requires at least 64x64*/
__driUtilMessage("Not enough texture memory. "
"Falling back to indirect rendering.");
_mesa_free(imesa);
free(imesa);
return GL_FALSE;
}
@ -574,7 +574,7 @@ savageDestroyContext(__DRIcontext *driContextPriv)
_mesa_destroy_context(imesa->glCtx);
/* no longer use vertex_dma_buf*/
_mesa_free(imesa);
free(imesa);
}
}

View file

@ -603,7 +603,7 @@ _savage_texstore_a1114444(TEXSTORE_PARAMS)
dstRow += dstRowStride;
}
}
_mesa_free((void *) tempImage);
free((void *) tempImage);
return GL_TRUE;
}
@ -643,7 +643,7 @@ _savage_texstore_a1118888(TEXSTORE_PARAMS)
dstRow += dstRowStride;
}
}
_mesa_free((void *) tempImage);
free((void *) tempImage);
return GL_TRUE;
}

View file

@ -155,7 +155,7 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions,
TRACE;
psp = _mesa_calloc(sizeof(*psp));
psp = calloc(1, sizeof(*psp));
if (!psp)
return NULL;
@ -184,7 +184,7 @@ static void driDestroyScreen(__DRIscreen *psp)
TRACE;
if (psp) {
_mesa_free(psp);
free(psp);
}
}
@ -241,8 +241,8 @@ swrast_delete_renderbuffer(struct gl_renderbuffer *rb)
{
TRACE;
_mesa_free(rb->Data);
_mesa_free(rb);
free(rb->Data);
free(rb);
}
static GLboolean
@ -272,11 +272,11 @@ swrast_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
TRACE;
_mesa_free(rb->Data);
free(rb->Data);
swrast_alloc_front_storage(ctx, rb, internalFormat, width, height);
rb->Data = _mesa_malloc(height * xrb->pitch);
rb->Data = malloc(height * xrb->pitch);
return GL_TRUE;
}
@ -284,7 +284,7 @@ swrast_alloc_back_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
static struct swrast_renderbuffer *
swrast_new_renderbuffer(const GLvisual *visual, GLboolean front)
{
struct swrast_renderbuffer *xrb = _mesa_calloc(sizeof *xrb);
struct swrast_renderbuffer *xrb = calloc(1, sizeof *xrb);
GLuint pixel_format;
TRACE;
@ -358,7 +358,7 @@ driCreateNewDrawable(__DRIscreen *screen,
TRACE;
buf = _mesa_calloc(sizeof *buf);
buf = calloc(1, sizeof *buf);
if (!buf)
return NULL;
@ -366,7 +366,7 @@ driCreateNewDrawable(__DRIscreen *screen,
buf->driScreenPriv = screen;
buf->row = _mesa_malloc(MAX_WIDTH * 4);
buf->row = malloc(MAX_WIDTH * 4);
/* basic framebuffer setup */
_mesa_initialize_window_framebuffer(&buf->Base, &config->modes);
@ -401,7 +401,7 @@ driDestroyDrawable(__DRIdrawable *buf)
if (buf) {
struct gl_framebuffer *fb = &buf->Base;
_mesa_free(buf->row);
free(buf->row);
fb->DeletePending = GL_TRUE;
_mesa_reference_framebuffer(&fb, NULL);
@ -525,7 +525,7 @@ driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
TRACE;
ctx = _mesa_calloc(sizeof *ctx);
ctx = calloc(1, sizeof *ctx);
if (!ctx)
return NULL;
@ -540,7 +540,7 @@ driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
if (!_mesa_initialize_context(&ctx->Base, &config->modes,
shared ? &shared->Base : NULL,
&functions, (void *) ctx)) {
_mesa_free(ctx);
free(ctx);
return NULL;
}

View file

@ -156,7 +156,7 @@ via_alloc_texture(struct via_context *vmesa,
}
else if (t->memType == VIA_MEM_SYSTEM) {
t->bufAddr = _mesa_malloc(t->size);
t->bufAddr = malloc(t->size);
if (!t->bufAddr)
goto cleanup;
@ -226,8 +226,8 @@ via_free_texture(struct via_context *vmesa, struct via_tex_buffer *t)
else if (t->memType == VIA_MEM_SYSTEM) {
remove_from_list(t);
vmesa->total_alloc[t->memType] -= t->size;
_mesa_free(t->bufAddr);
_mesa_free(t);
free(t->bufAddr);
free(t);
}
else if (t->index && viaCheckBreadcrumb(vmesa, t->lastUsed)) {
via_do_free_texture( vmesa, t );

View file

@ -392,7 +392,7 @@ glFBDevCreateVisual( const struct fb_fix_screeninfo *fixInfo,
break;
default:
/* unexpected token */
_mesa_free(vis);
free(vis);
return NULL;
}
}
@ -431,7 +431,7 @@ glFBDevCreateVisual( const struct fb_fix_screeninfo *fixInfo,
}
else {
_mesa_problem(NULL, "Unsupported fbdev RGB visual/bitdepth!\n");
_mesa_free(vis);
free(vis);
return NULL;
}
}
@ -445,7 +445,7 @@ glFBDevCreateVisual( const struct fb_fix_screeninfo *fixInfo,
}
else {
_mesa_problem(NULL, "Unsupported fbdev CI visual/bitdepth!\n");
_mesa_free(vis);
free(vis);
return NULL;
}
}
@ -457,7 +457,7 @@ glFBDevCreateVisual( const struct fb_fix_screeninfo *fixInfo,
accumBlueBits, accumAlphaBits,
numSamples)) {
/* something was invalid */
_mesa_free(vis);
free(vis);
return NULL;
}
@ -469,7 +469,7 @@ void
glFBDevDestroyVisual( GLFBDevVisualPtr visual )
{
if (visual)
_mesa_free(visual);
free(visual);
}
@ -488,9 +488,9 @@ delete_renderbuffer(struct gl_renderbuffer *rb)
{
struct GLFBDevRenderbufferRec *frb = (struct GLFBDevRenderbufferRec *) rb;
if (frb->mallocedBuffer) {
_mesa_free(frb->Base.Data);
free(frb->Base.Data);
}
_mesa_free(frb);
free(frb);
}
@ -636,10 +636,10 @@ glFBDevCreateBuffer( const struct fb_fix_screeninfo *fixInfo,
const int malloced = !backBuffer;
if (malloced) {
/* malloc a back buffer */
backBuffer = _mesa_malloc(size);
backBuffer = malloc(size);
if (!backBuffer) {
_mesa_free_framebuffer_data(&buf->glframebuffer);
_mesa_free(buf);
free(buf);
return NULL;
}
}
@ -769,7 +769,7 @@ glFBDevCreateContext( const GLFBDevVisualPtr visual, GLFBDevContextPtr share )
if (!_mesa_initialize_context(&ctx->glcontext, &visual->glvisual,
share ? &share->glcontext : NULL,
&functions, (void *) ctx)) {
_mesa_free(ctx);
free(ctx);
return NULL;
}
@ -818,7 +818,7 @@ glFBDevDestroyContext( GLFBDevContextPtr context )
_mesa_make_current(NULL, NULL, NULL);
}
_mesa_free_context_data(&context->glcontext);
_mesa_free(context);
free(context);
}
}

View file

@ -1628,7 +1628,7 @@ fxDDGetString(GLcontext * ctx, GLenum name)
if (ctx->Extensions.String == NULL) {
GLubyte *ext = _mesa_make_extension_string(ctx);
if (ext != NULL) {
ctx->Extensions.String = _mesa_malloc(strlen((char *)ext) + 256);
ctx->Extensions.String = malloc(strlen((char *)ext) + 256);
if (ctx->Extensions.String != NULL) {
strcpy((char *)ctx->Extensions.String, (char *)ext);
/* put any additional extension names here */
@ -1641,7 +1641,7 @@ fxDDGetString(GLcontext * ctx, GLenum name)
strcat((char *)ctx->Extensions.String, " WGL_EXT_extensions_string WGL_ARB_extensions_string");
#endif
/* put any additional extension names here */
_mesa_free(ext);
free(ext);
} else {
ctx->Extensions.String = ext;
}

View file

@ -1397,10 +1397,10 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level,
mml->width,
mml->height, 1);
dstRowStride = _mesa_format_row_stride(texImage->TexFormat, mml->width);
texImage->Data = _mesa_malloc(texImage->CompressedSize);
texImage->Data = malloc(texImage->CompressedSize);
} else {
dstRowStride = mml->width * texelBytes;
texImage->Data = _mesa_malloc(mml->width * mml->height * texelBytes);
texImage->Data = malloc(mml->width * mml->height * texelBytes);
}
if (!texImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D");
@ -1654,7 +1654,7 @@ fxDDCompressedTexImage2D (GLcontext *ctx, GLenum target,
texImage->CompressedSize = _mesa_format_image_size(texImage->TexFormat,
mml->width,
mml->height, 1);
texImage->Data = _mesa_malloc(texImage->CompressedSize);
texImage->Data = malloc(texImage->CompressedSize);
if (!texImage->Data) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D");
return;

View file

@ -107,14 +107,14 @@ fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj)
&(mml->wScale), &(mml->hScale));
_w *= mml->wScale;
_h *= mml->hScale;
texImage->Data = _mesa_malloc(_w * _h * texelBytes);
texImage->Data = malloc(_w * _h * texelBytes);
_mesa_rescale_teximage2d(texelBytes,
mml->width,
_w * texelBytes, /* dst stride */
mml->width, mml->height, /* src */
_w, _h, /* dst */
texImage_Data /*src*/, texImage->Data /*dst*/ );
_mesa_free(texImage_Data);
free(texImage_Data);
mml->width = _w;
mml->height = _h;
/* (!) ... and set mml->wScale = _w / texImage->Width */

View file

@ -119,7 +119,7 @@ CreateContext(void)
0, 0, 0, 0, 1); /* accum */
buf = _mesa_create_framebuffer(vis);
cc = _mesa_calloc(sizeof(*cc));
cc = calloc(1, sizeof(*cc));
if (!vis || !buf || !cc) {
if (vis)
_mesa_destroy_visual(vis);
@ -143,7 +143,7 @@ CreateContext(void)
!_swsetup_CreateContext( ctx )) {
_mesa_destroy_visual(vis);
_mesa_free_context_data(ctx);
_mesa_free(cc);
free(cc);
return GL_FALSE;
}
TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline;

View file

@ -818,7 +818,7 @@ compute_row_addresses( OSMesaContext osmesa )
static void
osmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
{
_mesa_free(rb);
free(rb);
}
@ -1189,7 +1189,7 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
1 /* num samples */
);
if (!osmesa->gl_visual) {
_mesa_free(osmesa);
free(osmesa);
return NULL;
}
@ -1206,7 +1206,7 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
: (GLcontext *) NULL,
&functions, (void *) osmesa)) {
_mesa_destroy_visual( osmesa->gl_visual );
_mesa_free(osmesa);
free(osmesa);
return NULL;
}
@ -1221,7 +1221,7 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
if (!osmesa->gl_buffer) {
_mesa_destroy_visual( osmesa->gl_visual );
_mesa_free_context_data( &osmesa->mesa );
_mesa_free(osmesa);
free(osmesa);
return NULL;
}
@ -1260,7 +1260,7 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
!_swsetup_CreateContext( ctx )) {
_mesa_destroy_visual(osmesa->gl_visual);
_mesa_free_context_data(ctx);
_mesa_free(osmesa);
free(osmesa);
return NULL;
}
@ -1305,7 +1305,7 @@ OSMesaDestroyContext( OSMesaContext osmesa )
_mesa_reference_framebuffer( &osmesa->gl_buffer, NULL );
_mesa_free_context_data( &osmesa->mesa );
_mesa_free( osmesa );
free( osmesa );
}
}

View file

@ -868,7 +868,6 @@ EXPORTS
_mesa_add_soft_renderbuffers
_mesa_add_renderbuffer
_mesa_bzero
_mesa_calloc
_mesa_check_conditional_render
_mesa_choose_tex_format
_mesa_create_framebuffer
@ -887,7 +886,6 @@ EXPORTS
_mesa_error
_mesa_finish_render_texture
_mesa_framebuffer_renderbuffer
_mesa_free
_mesa_free_context_data
_mesa_free_texture_image_data
_mesa_generate_mipmap

View file

@ -1245,7 +1245,7 @@ static void read_rgba_pixels_16(const GLcontext *ctx,
static void
wmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
{
_mesa_free(rb);
free(rb);
}
@ -1474,7 +1474,7 @@ WMesaContext WMesaCreateContext(HDC hDC,
1); /* num samples */
if (!visual) {
_mesa_free(c);
free(c);
return NULL;
}
@ -1512,7 +1512,7 @@ WMesaContext WMesaCreateContext(HDC hDC,
!_tnl_CreateContext(ctx) ||
!_swsetup_CreateContext(ctx)) {
_mesa_free_context_data(ctx);
_mesa_free(c);
free(c);
return NULL;
}
_swsetup_Wakeup(ctx);
@ -1557,7 +1557,7 @@ void WMesaDestroyContext( WMesaContext pwc )
_swrast_DestroyContext(ctx);
_mesa_free_context_data(ctx);
_mesa_free(pwc);
free(pwc);
}

View file

@ -32,8 +32,6 @@ EXPORTS
_mesa_buffer_data
_mesa_buffer_map
_mesa_buffer_subdata
_mesa_bzero
_mesa_calloc
_mesa_choose_tex_format
_mesa_compressed_texture_size
_mesa_create_framebuffer
@ -47,7 +45,6 @@ EXPORTS
_mesa_enable_1_5_extensions
_mesa_enable_sw_extensions
_mesa_error
_mesa_free
_mesa_free_context_data
_mesa_get_current_context
_mesa_init_default_imports

View file

@ -1381,7 +1381,7 @@ Fake_glXChooseVisual( Display *dpy, int screen, int *list )
return xmvis->vishandle;
#else
/* create a new vishandle - the cached one may be stale */
xmvis->vishandle = (XVisualInfo *) _mesa_malloc(sizeof(XVisualInfo));
xmvis->vishandle = (XVisualInfo *) malloc(sizeof(XVisualInfo));
if (xmvis->vishandle) {
memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
}
@ -1438,7 +1438,7 @@ Fake_glXCreateContext( Display *dpy, XVisualInfo *visinfo,
xmvis = create_glx_visual( dpy, visinfo );
if (!xmvis) {
/* unusable visual */
_mesa_free(glxCtx);
free(glxCtx);
return NULL;
}
}
@ -1446,7 +1446,7 @@ Fake_glXCreateContext( Display *dpy, XVisualInfo *visinfo,
glxCtx->xmesaContext = XMesaCreateContext(xmvis,
shareCtx ? shareCtx->xmesaContext : NULL);
if (!glxCtx->xmesaContext) {
_mesa_free(glxCtx);
free(glxCtx);
return NULL;
}
@ -1671,7 +1671,7 @@ Fake_glXDestroyContext( Display *dpy, GLXContext ctx )
MakeCurrent_PrevReadBuffer = 0;
XMesaDestroyContext( glxCtx->xmesaContext );
XMesaGarbageCollect();
_mesa_free(glxCtx);
free(glxCtx);
}
@ -2108,7 +2108,7 @@ Fake_glXGetFBConfigs( Display *dpy, int screen, int *nelements )
visuals = XGetVisualInfo(dpy, visMask, &visTemplate, nelements);
if (*nelements > 0) {
XMesaVisual *results;
results = (XMesaVisual *) _mesa_malloc(*nelements * sizeof(XMesaVisual));
results = (XMesaVisual *) malloc(*nelements * sizeof(XMesaVisual));
if (!results) {
*nelements = 0;
return NULL;
@ -2135,7 +2135,7 @@ Fake_glXChooseFBConfig( Display *dpy, int screen,
xmvis = choose_visual(dpy, screen, attribList, GL_TRUE);
if (xmvis) {
GLXFBConfig *config = (GLXFBConfig *) _mesa_malloc(sizeof(XMesaVisual));
GLXFBConfig *config = (GLXFBConfig *) malloc(sizeof(XMesaVisual));
if (!config) {
*nitems = 0;
return NULL;
@ -2160,7 +2160,7 @@ Fake_glXGetVisualFromFBConfig( Display *dpy, GLXFBConfig config )
return xmvis->vishandle;
#else
/* create a new vishandle - the cached one may be stale */
xmvis->vishandle = (XVisualInfo *) _mesa_malloc(sizeof(XVisualInfo));
xmvis->vishandle = (XVisualInfo *) malloc(sizeof(XVisualInfo));
if (xmvis->vishandle) {
memcpy(xmvis->vishandle, xmvis->visinfo, sizeof(XVisualInfo));
}
@ -2469,7 +2469,7 @@ Fake_glXCreateNewContext( Display *dpy, GLXFBConfig config,
glxCtx->xmesaContext = XMesaCreateContext(xmvis,
shareCtx ? shareCtx->xmesaContext : NULL);
if (!glxCtx->xmesaContext) {
_mesa_free(glxCtx);
free(glxCtx);
return NULL;
}
@ -2687,7 +2687,7 @@ Fake_glXCreateContextWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, int re
glxCtx->xmesaContext = XMesaCreateContext(xmvis,
shareCtx ? shareCtx->xmesaContext : NULL);
if (!glxCtx->xmesaContext) {
_mesa_free(glxCtx);
free(glxCtx);
return NULL;
}

View file

@ -253,7 +253,7 @@ bits_per_pixel( XMesaVisual xmv )
/* grab the bits/pixel value */
bitsPerPixel = img->bits_per_pixel;
/* free the XImage */
_mesa_free( img->data );
free( img->data );
img->data = NULL;
XMesaDestroyImage( img );
return bitsPerPixel;
@ -383,7 +383,7 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
*/
b->frontxrb = xmesa_new_renderbuffer(NULL, 0, &vis->mesa_visual, GL_FALSE);
if (!b->frontxrb) {
_mesa_free(b);
free(b);
return NULL;
}
b->frontxrb->Parent = b;
@ -399,7 +399,7 @@ create_xmesa_buffer(XMesaDrawable d, BufferType type,
b->backxrb = xmesa_new_renderbuffer(NULL, 0, &vis->mesa_visual, GL_TRUE);
if (!b->backxrb) {
/* XXX free front xrb too */
_mesa_free(b);
free(b);
return NULL;
}
b->backxrb->Parent = b;
@ -596,7 +596,7 @@ noFaultXAllocColor( int client,
|| prevCmapSize != cmapSize || !ctable) {
/* free previously cached color table */
if (ctable)
_mesa_free(ctable);
free(ctable);
/* Get the color table from X */
ctable = (XMesaColor *) MALLOC(cmapSize * sizeof(XMesaColor));
assert(ctable);
@ -652,8 +652,8 @@ noFaultXAllocColor( int client,
*alloced = 0;
}
#ifdef XFree86Server
_mesa_free(ppixIn);
_mesa_free(ctable);
free(ppixIn);
free(ctable);
#else
/* don't free table, save it for next time */
#endif
@ -1366,14 +1366,14 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display,
v->display = display;
/* Save a copy of the XVisualInfo struct because the user may X_mesa_free()
/* Save a copy of the XVisualInfo struct because the user may Xfree()
* the struct but we may need some of the information contained in it
* at a later time.
*/
#ifndef XFree86Server
v->visinfo = (XVisualInfo *) MALLOC(sizeof(*visinfo));
if(!v->visinfo) {
_mesa_free(v);
free(v);
return NULL;
}
memcpy(v->visinfo, visinfo, sizeof(*visinfo));
@ -1473,9 +1473,9 @@ PUBLIC
void XMesaDestroyVisual( XMesaVisual v )
{
#ifndef XFree86Server
_mesa_free(v->visinfo);
free(v->visinfo);
#endif
_mesa_free(v);
free(v);
}
@ -1514,7 +1514,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
if (!_mesa_initialize_context(mesaCtx, &v->mesa_visual,
share_list ? &(share_list->mesa) : (GLcontext *) NULL,
&functions, (void *) c)) {
_mesa_free(c);
free(c);
return NULL;
}
@ -1564,7 +1564,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list )
!_tnl_CreateContext( mesaCtx ) ||
!_swsetup_CreateContext( mesaCtx )) {
_mesa_free_context_data(&c->mesa);
_mesa_free(c);
free(c);
return NULL;
}
@ -1598,7 +1598,7 @@ void XMesaDestroyContext( XMesaContext c )
_tnl_DestroyContext( mesaCtx );
_vbo_DestroyContext( mesaCtx );
_mesa_free_context_data( mesaCtx );
_mesa_free( c );
free( c );
}

View file

@ -242,7 +242,7 @@ xmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
* should probably get freed here, but that's currently done in
* XMesaDestroyBuffer().
*/
_mesa_free(rb);
free(rb);
}
@ -412,11 +412,11 @@ xmesa_delete_framebuffer(struct gl_framebuffer *fb)
}
if (b->rowimage) {
_mesa_free( b->rowimage->data );
free( b->rowimage->data );
b->rowimage->data = NULL;
XMesaDestroyImage( b->rowimage );
}
_mesa_free_framebuffer_data(fb);
_mesa_free(fb);
free(fb);
}

View file

@ -167,7 +167,7 @@ compute_es_extensions(void)
unsigned int len;
len = make_extension_string(ctx, NULL);
s = (char *) _mesa_malloc(len + 1);
s = (char *) malloc(len + 1);
if (!s)
return NULL;
make_extension_string(ctx, s);

View file

@ -138,7 +138,7 @@ compute_es_extensions(void)
unsigned int len;
len = make_extension_string(ctx, NULL);
s = (char *) _mesa_malloc(len + 1);
s = (char *) malloc(len + 1);
if (!s)
return NULL;
make_extension_string(ctx, s);

View file

@ -113,8 +113,6 @@ def PrintTail():
print '\t_mesa_buffer_data'
print '\t_mesa_buffer_map'
print '\t_mesa_buffer_subdata'
print '\t_mesa_bzero'
print '\t_mesa_calloc'
print '\t_mesa_choose_tex_format'
print '\t_mesa_compressed_texture_size'
print '\t_mesa_create_framebuffer'
@ -128,7 +126,6 @@ def PrintTail():
print '\t_mesa_enable_1_5_extensions'
print '\t_mesa_enable_sw_extensions'
print '\t_mesa_error'
print '\t_mesa_free'
print '\t_mesa_free_context_data'
print '\t_mesa_get_current_context'
print '\t_mesa_init_default_imports'

View file

@ -130,7 +130,7 @@ _mesa_delete_array_object( GLcontext *ctx, struct gl_array_object *obj )
(void) ctx;
unbind_array_object_vbos(ctx, obj);
_glthread_DESTROY_MUTEX(obj->Mutex);
_mesa_free(obj);
free(obj);
}

View file

@ -1559,8 +1559,8 @@ _mesa_free_attrib_data(GLcontext *ctx)
}
next = attr->next;
_mesa_free(attr->data);
_mesa_free(attr);
free(attr->data);
free(attr);
attr = next;
}
}

View file

@ -208,14 +208,14 @@ _mesa_delete_buffer_object( GLcontext *ctx, struct gl_buffer_object *bufObj )
(void) ctx;
if (bufObj->Data)
_mesa_free(bufObj->Data);
free(bufObj->Data);
/* assign strange values here to help w/ debugging */
bufObj->RefCount = -1000;
bufObj->Name = ~0;
_glthread_DESTROY_MUTEX(bufObj->Mutex);
_mesa_free(bufObj);
free(bufObj);
}

View file

@ -407,8 +407,8 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat,
_mesa_free_colortable_data(table);
if (width > 0) {
table->TableF = (GLfloat *) _mesa_malloc(comps * width * sizeof(GLfloat));
table->TableUB = (GLubyte *) _mesa_malloc(comps * width * sizeof(GLubyte));
table->TableF = (GLfloat *) malloc(comps * width * sizeof(GLfloat));
table->TableUB = (GLubyte *) malloc(comps * width * sizeof(GLubyte));
if (!table->TableF || !table->TableUB) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glColorTable");
@ -1095,11 +1095,11 @@ void
_mesa_free_colortable_data( struct gl_color_table *p )
{
if (p->TableF) {
_mesa_free(p->TableF);
free(p->TableF);
p->TableF = NULL;
}
if (p->TableUB) {
_mesa_free(p->TableUB);
free(p->TableUB);
p->TableUB = NULL;
}
}

View file

@ -222,7 +222,7 @@ _mesa_create_visual( GLboolean rgbFlag,
GLint accumAlphaBits,
GLint numSamples )
{
GLvisual *vis = (GLvisual *) _mesa_calloc(sizeof(GLvisual));
GLvisual *vis = (GLvisual *) calloc(1, sizeof(GLvisual));
if (vis) {
if (!_mesa_initialize_visual(vis, rgbFlag, dbFlag, stereoFlag,
redBits, greenBits, blueBits, alphaBits,
@ -230,7 +230,7 @@ _mesa_create_visual( GLboolean rgbFlag,
accumRedBits, accumGreenBits,
accumBlueBits, accumAlphaBits,
numSamples)) {
_mesa_free(vis);
free(vis);
return NULL;
}
}
@ -320,7 +320,7 @@ _mesa_initialize_visual( GLvisual *vis,
void
_mesa_destroy_visual( GLvisual *vis )
{
_mesa_free(vis);
free(vis);
}
/*@}*/
@ -755,7 +755,7 @@ alloc_dispatch_table(void)
GLint numEntries = MAX2(_glapi_get_dispatch_table_size(),
sizeof(struct _glapi_table) / sizeof(_glapi_proc));
struct _glapi_table *table =
(struct _glapi_table *) _mesa_malloc(numEntries * sizeof(_glapi_proc));
(struct _glapi_table *) malloc(numEntries * sizeof(_glapi_proc));
if (table) {
_glapi_proc *entry = (_glapi_proc *) table;
GLint i;
@ -850,7 +850,7 @@ _mesa_initialize_context(GLcontext *ctx,
if (!ctx->Exec || !ctx->Save) {
_mesa_release_shared_state(ctx, ctx->Shared);
if (ctx->Exec)
_mesa_free(ctx->Exec);
free(ctx->Exec);
return GL_FALSE;
}
#if FEATURE_dispatch
@ -913,7 +913,7 @@ _mesa_create_context(const GLvisual *visual,
ASSERT(visual);
/*ASSERT(driverContext);*/
ctx = (GLcontext *) _mesa_calloc(sizeof(GLcontext));
ctx = (GLcontext *) calloc(1, sizeof(GLcontext));
if (!ctx)
return NULL;
@ -922,7 +922,7 @@ _mesa_create_context(const GLvisual *visual,
return ctx;
}
else {
_mesa_free(ctx);
free(ctx);
return NULL;
}
}
@ -989,8 +989,8 @@ _mesa_free_context_data( GLcontext *ctx )
#endif
/* free dispatch tables */
_mesa_free(ctx->Exec);
_mesa_free(ctx->Save);
free(ctx->Exec);
free(ctx->Save);
/* Shared context state (display lists, textures, etc) */
_mesa_release_shared_state( ctx, ctx->Shared );
@ -999,10 +999,10 @@ _mesa_free_context_data( GLcontext *ctx )
_mesa_free_display_list_data(ctx);
if (ctx->Extensions.String)
_mesa_free((void *) ctx->Extensions.String);
free((void *) ctx->Extensions.String);
if (ctx->VersionString)
_mesa_free(ctx->VersionString);
free(ctx->VersionString);
/* unbind the context if it's currently bound */
if (ctx == _mesa_get_current_context()) {
@ -1023,7 +1023,7 @@ _mesa_destroy_context( GLcontext *ctx )
{
if (ctx) {
_mesa_free_context_data(ctx);
_mesa_free( (void *) ctx );
free( (void *) ctx );
}
}

View file

@ -43,7 +43,7 @@ _mesa_get_cpu_features(void)
/**
* Return a string describing the CPU architexture and extensions that
* Mesa is using (such as SSE or Altivec).
* \return information string, free it with _mesa_free()
* \return information string, free it with free()
*/
char *
_mesa_get_cpu_string(void)
@ -51,7 +51,7 @@ _mesa_get_cpu_string(void)
#define MAX_STRING 50
char *buffer;
buffer = (char *) _mesa_malloc(MAX_STRING);
buffer = (char *) malloc(MAX_STRING);
if (!buffer)
return NULL;

View file

@ -303,7 +303,7 @@ write_texture_image(struct gl_texture_object *texObj,
GLubyte *buffer;
char s[100];
buffer = (GLubyte *) _mesa_malloc(img->Width * img->Height
buffer = (GLubyte *) malloc(img->Width * img->Height
* img->Depth * 4);
store = ctx->Pack; /* save */
@ -321,7 +321,7 @@ write_texture_image(struct gl_texture_object *texObj,
ctx->Pack = store; /* restore */
_mesa_free(buffer);
free(buffer);
}
}
@ -350,7 +350,7 @@ write_renderbuffer_image(const struct gl_renderbuffer *rb)
return;
}
buffer = (GLubyte *) _mesa_malloc(rb->Width * rb->Height * 4);
buffer = (GLubyte *) malloc(rb->Width * rb->Height * 4);
ctx->Driver.ReadPixels(ctx, 0, 0, rb->Width, rb->Height,
format, type, &ctx->DefaultPacking, buffer);
@ -361,7 +361,7 @@ write_renderbuffer_image(const struct gl_renderbuffer *rb)
_mesa_printf(" Writing renderbuffer image to %s\n", s);
write_ppm(s, buffer, rb->Width, rb->Height, 4, 0, 1, 2, GL_TRUE);
_mesa_free(buffer);
free(buffer);
}
@ -481,7 +481,7 @@ _mesa_dump_color_buffer(const char *filename)
const GLuint h = ctx->DrawBuffer->Height;
GLubyte *buf;
buf = (GLubyte *) _mesa_malloc(w * h * 4);
buf = (GLubyte *) malloc(w * h * 4);
_mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
_mesa_PixelStorei(GL_PACK_ALIGNMENT, 1);
@ -499,7 +499,7 @@ _mesa_dump_color_buffer(const char *filename)
_mesa_PopClientAttrib();
_mesa_free(buf);
free(buf);
}
@ -513,8 +513,8 @@ _mesa_dump_depth_buffer(const char *filename)
GLubyte *buf2;
GLuint i;
buf = (GLuint *) _mesa_malloc(w * h * 4); /* 4 bpp */
buf2 = (GLubyte *) _mesa_malloc(w * h * 3); /* 3 bpp */
buf = (GLuint *) malloc(w * h * 4); /* 4 bpp */
buf2 = (GLubyte *) malloc(w * h * 3); /* 3 bpp */
_mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
_mesa_PixelStorei(GL_PACK_ALIGNMENT, 1);
@ -534,8 +534,8 @@ _mesa_dump_depth_buffer(const char *filename)
_mesa_PopClientAttrib();
_mesa_free(buf);
_mesa_free(buf2);
free(buf);
free(buf2);
}
@ -549,8 +549,8 @@ _mesa_dump_stencil_buffer(const char *filename)
GLubyte *buf2;
GLuint i;
buf = (GLubyte *) _mesa_malloc(w * h); /* 1 bpp */
buf2 = (GLubyte *) _mesa_malloc(w * h * 3); /* 3 bpp */
buf = (GLubyte *) malloc(w * h); /* 1 bpp */
buf2 = (GLubyte *) malloc(w * h * 3); /* 3 bpp */
_mesa_PushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
_mesa_PixelStorei(GL_PACK_ALIGNMENT, 1);
@ -569,8 +569,8 @@ _mesa_dump_stencil_buffer(const char *filename)
_mesa_PopClientAttrib();
_mesa_free(buf);
_mesa_free(buf2);
free(buf);
free(buf2);
}

View file

@ -65,7 +65,7 @@ delete_wrapper(struct gl_renderbuffer *rb)
ASSERT(rb->Format == MESA_FORMAT_Z24_S8 ||
rb->Format == MESA_FORMAT_S8_Z24);
_mesa_reference_renderbuffer(&rb->Wrapped, NULL);
_mesa_free(rb);
free(rb);
}
@ -818,5 +818,5 @@ _mesa_promote_stencil(GLcontext *ctx, struct gl_renderbuffer *stencilRb)
}
stencilRb->PutRow(ctx, stencilRb, width, 0, i, depthStencil, NULL);
}
_mesa_free(data);
free(data);
}

View file

@ -472,7 +472,7 @@ make_list(GLuint name, GLuint count)
{
struct gl_display_list *dlist = CALLOC_STRUCT(gl_display_list);
dlist->Name = name;
dlist->Head = (Node *) _mesa_malloc(sizeof(Node) * count);
dlist->Head = (Node *) malloc(sizeof(Node) * count);
dlist->Head[0].opcode = OPCODE_END_OF_LIST;
return dlist;
}
@ -557,108 +557,108 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist)
switch (opcode) {
/* for some commands, we need to free malloc'd memory */
case OPCODE_MAP1:
_mesa_free(n[6].data);
free(n[6].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_MAP2:
_mesa_free(n[10].data);
free(n[10].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_DRAW_PIXELS:
_mesa_free(n[5].data);
free(n[5].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_BITMAP:
_mesa_free(n[7].data);
free(n[7].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_COLOR_TABLE:
_mesa_free(n[6].data);
free(n[6].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_COLOR_SUB_TABLE:
_mesa_free(n[6].data);
free(n[6].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_CONVOLUTION_FILTER_1D:
_mesa_free(n[6].data);
free(n[6].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_CONVOLUTION_FILTER_2D:
_mesa_free(n[7].data);
free(n[7].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_POLYGON_STIPPLE:
_mesa_free(n[1].data);
free(n[1].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_IMAGE1D:
_mesa_free(n[8].data);
free(n[8].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_IMAGE2D:
_mesa_free(n[9].data);
free(n[9].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_IMAGE3D:
_mesa_free(n[10].data);
free(n[10].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_SUB_IMAGE1D:
_mesa_free(n[7].data);
free(n[7].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_SUB_IMAGE2D:
_mesa_free(n[9].data);
free(n[9].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_TEX_SUB_IMAGE3D:
_mesa_free(n[11].data);
free(n[11].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_COMPRESSED_TEX_IMAGE_1D:
_mesa_free(n[7].data);
free(n[7].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_COMPRESSED_TEX_IMAGE_2D:
_mesa_free(n[8].data);
free(n[8].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_COMPRESSED_TEX_IMAGE_3D:
_mesa_free(n[9].data);
free(n[9].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D:
_mesa_free(n[7].data);
free(n[7].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D:
_mesa_free(n[9].data);
free(n[9].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D:
_mesa_free(n[11].data);
free(n[11].data);
n += InstSize[n[0].opcode];
break;
#if FEATURE_NV_vertex_program
case OPCODE_LOAD_PROGRAM_NV:
_mesa_free(n[4].data); /* program string */
free(n[4].data); /* program string */
n += InstSize[n[0].opcode];
break;
case OPCODE_REQUEST_RESIDENT_PROGRAMS_NV:
_mesa_free(n[2].data); /* array of program ids */
free(n[2].data); /* array of program ids */
n += InstSize[n[0].opcode];
break;
#endif
#if FEATURE_NV_fragment_program
case OPCODE_PROGRAM_NAMED_PARAMETER_NV:
_mesa_free(n[3].data); /* parameter name */
free(n[3].data); /* parameter name */
n += InstSize[n[0].opcode];
break;
#endif
#if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program
case OPCODE_PROGRAM_STRING_ARB:
_mesa_free(n[4].data); /* program string */
free(n[4].data); /* program string */
n += InstSize[n[0].opcode];
break;
#endif
@ -670,7 +670,7 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist)
case OPCODE_UNIFORM_2IV:
case OPCODE_UNIFORM_3IV:
case OPCODE_UNIFORM_4IV:
_mesa_free(n[3].data);
free(n[3].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_UNIFORM_MATRIX22:
@ -682,17 +682,17 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist)
case OPCODE_UNIFORM_MATRIX32:
case OPCODE_UNIFORM_MATRIX34:
case OPCODE_UNIFORM_MATRIX43:
_mesa_free(n[4].data);
free(n[4].data);
n += InstSize[n[0].opcode];
break;
case OPCODE_CONTINUE:
n = (Node *) n[1].next;
_mesa_free(block);
free(block);
block = n;
break;
case OPCODE_END_OF_LIST:
_mesa_free(block);
free(block);
done = GL_TRUE;
break;
default:
@ -703,7 +703,7 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist)
}
}
_mesa_free(dlist);
free(dlist);
}
@ -869,7 +869,7 @@ dlist_alloc(GLcontext *ctx, OpCode opcode, GLuint bytes)
Node *newblock;
n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos;
n[0].opcode = OPCODE_CONTINUE;
newblock = (Node *) _mesa_malloc(sizeof(Node) * BLOCK_SIZE);
newblock = (Node *) malloc(sizeof(Node) * BLOCK_SIZE);
if (!newblock) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "Building display list");
return NULL;
@ -2912,7 +2912,7 @@ save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values)
if (n) {
n[1].e = map;
n[2].i = mapsize;
n[3].data = (void *) _mesa_malloc(mapsize * sizeof(GLfloat));
n[3].data = (void *) malloc(mapsize * sizeof(GLfloat));
memcpy(n[3].data, (void *) values, mapsize * sizeof(GLfloat));
}
if (ctx->ExecuteFlag) {
@ -4360,7 +4360,7 @@ save_CompressedTexImage1DARB(GLenum target, GLint level,
GLvoid *image;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
/* make copy of image */
image = _mesa_malloc(imageSize);
image = malloc(imageSize);
if (!image) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage1DARB");
return;
@ -4377,7 +4377,7 @@ save_CompressedTexImage1DARB(GLenum target, GLint level,
n[7].data = image;
}
else if (image) {
_mesa_free(image);
free(image);
}
if (ctx->ExecuteFlag) {
CALL_CompressedTexImage1DARB(ctx->Exec,
@ -4406,7 +4406,7 @@ save_CompressedTexImage2DARB(GLenum target, GLint level,
GLvoid *image;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
/* make copy of image */
image = _mesa_malloc(imageSize);
image = malloc(imageSize);
if (!image) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2DARB");
return;
@ -4424,7 +4424,7 @@ save_CompressedTexImage2DARB(GLenum target, GLint level,
n[8].data = image;
}
else if (image) {
_mesa_free(image);
free(image);
}
if (ctx->ExecuteFlag) {
CALL_CompressedTexImage2DARB(ctx->Exec,
@ -4453,7 +4453,7 @@ save_CompressedTexImage3DARB(GLenum target, GLint level,
GLvoid *image;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
/* make copy of image */
image = _mesa_malloc(imageSize);
image = malloc(imageSize);
if (!image) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage3DARB");
return;
@ -4472,7 +4472,7 @@ save_CompressedTexImage3DARB(GLenum target, GLint level,
n[9].data = image;
}
else if (image) {
_mesa_free(image);
free(image);
}
if (ctx->ExecuteFlag) {
CALL_CompressedTexImage3DARB(ctx->Exec,
@ -4496,7 +4496,7 @@ save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
/* make copy of image */
image = _mesa_malloc(imageSize);
image = malloc(imageSize);
if (!image) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage1DARB");
return;
@ -4513,7 +4513,7 @@ save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset,
n[7].data = image;
}
else if (image) {
_mesa_free(image);
free(image);
}
if (ctx->ExecuteFlag) {
CALL_CompressedTexSubImage1DARB(ctx->Exec, (target, level, xoffset,
@ -4536,7 +4536,7 @@ save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
/* make copy of image */
image = _mesa_malloc(imageSize);
image = malloc(imageSize);
if (!image) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage2DARB");
return;
@ -4555,7 +4555,7 @@ save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset,
n[9].data = image;
}
else if (image) {
_mesa_free(image);
free(image);
}
if (ctx->ExecuteFlag) {
CALL_CompressedTexSubImage2DARB(ctx->Exec,
@ -4578,7 +4578,7 @@ save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
/* make copy of image */
image = _mesa_malloc(imageSize);
image = malloc(imageSize);
if (!image) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexSubImage3DARB");
return;
@ -4599,7 +4599,7 @@ save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset,
n[11].data = image;
}
else if (image) {
_mesa_free(image);
free(image);
}
if (ctx->ExecuteFlag) {
CALL_CompressedTexSubImage3DARB(ctx->Exec,
@ -4788,7 +4788,7 @@ save_LoadProgramNV(GLenum target, GLuint id, GLsizei len,
n = alloc_instruction(ctx, OPCODE_LOAD_PROGRAM_NV, 4);
if (n) {
GLubyte *programCopy = (GLubyte *) _mesa_malloc(len);
GLubyte *programCopy = (GLubyte *) malloc(len);
if (!programCopy) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
return;
@ -4815,7 +4815,7 @@ save_RequestResidentProgramsNV(GLsizei num, const GLuint * ids)
n = alloc_instruction(ctx, OPCODE_TRACK_MATRIX_NV, 2);
if (n) {
GLuint *idCopy = (GLuint *) _mesa_malloc(num * sizeof(GLuint));
GLuint *idCopy = (GLuint *) malloc(num * sizeof(GLuint));
if (!idCopy) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glRequestResidentProgramsNV");
return;
@ -4986,7 +4986,7 @@ save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte * name,
n = alloc_instruction(ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6);
if (n) {
GLubyte *nameCopy = (GLubyte *) _mesa_malloc(len);
GLubyte *nameCopy = (GLubyte *) malloc(len);
if (!nameCopy) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramNamedParameter4fNV");
return;
@ -5085,7 +5085,7 @@ save_ProgramStringARB(GLenum target, GLenum format, GLsizei len,
n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 4);
if (n) {
GLubyte *programCopy = (GLubyte *) _mesa_malloc(len);
GLubyte *programCopy = (GLubyte *) malloc(len);
if (!programCopy) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
return;
@ -6199,7 +6199,7 @@ save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
static void *
memdup(const void *src, GLsizei bytes)
{
void *b = bytes >= 0 ? _mesa_malloc(bytes) : NULL;
void *b = bytes >= 0 ? malloc(bytes) : NULL;
if (b)
memcpy(b, src, bytes);
return b;

View file

@ -140,14 +140,14 @@ _mesa_exec_free(void *addr)
void *
_mesa_exec_malloc(GLuint size)
{
return _mesa_malloc( size );
return malloc( size );
}
void
_mesa_exec_free(void *addr)
{
_mesa_free(addr);
free(addr);
}

View file

@ -576,7 +576,7 @@ append(const char *a, const char *b)
{
const GLuint aLen = a ? strlen(a) : 0;
const GLuint bLen = b ? strlen(b) : 0;
char *s = _mesa_calloc(aLen + bLen + 1);
char *s = calloc(1, aLen + bLen + 1);
if (s) {
if (a)
memcpy(s, a, aLen);
@ -585,7 +585,7 @@ append(const char *a, const char *b)
s[aLen + bLen] = '\0';
}
if (a)
_mesa_free((void *) a);
free((void *) a);
return s;
}
@ -685,7 +685,7 @@ _mesa_make_extension_string( GLcontext *ctx )
extStrLen += strlen(extraExt) + 1; /* +1 for space */
/* allocate the extension string */
s = (char *) _mesa_malloc(extStrLen);
s = (char *) malloc(extStrLen);
if (!s)
return NULL;

View file

@ -192,7 +192,7 @@ _mesa_destroy_framebuffer(struct gl_framebuffer *fb)
{
if (fb) {
_mesa_free_framebuffer_data(fb);
_mesa_free(fb);
free(fb);
}
}

View file

@ -108,13 +108,13 @@ _mesa_DeleteHashTable(struct _mesa_HashTable *table)
_mesa_problem(NULL,
"In _mesa_DeleteHashTable, found non-freed data");
}
_mesa_free(entry);
free(entry);
entry = next;
}
}
_glthread_DESTROY_MUTEX(table->Mutex);
_glthread_DESTROY_MUTEX(table->WalkMutex);
_mesa_free(table);
free(table);
}
@ -245,7 +245,7 @@ _mesa_HashRemove(struct _mesa_HashTable *table, GLuint key)
else {
table->Table[pos] = entry->Next;
}
_mesa_free(entry);
free(entry);
_glthread_UNLOCK_MUTEX(table->Mutex);
return;
}
@ -282,7 +282,7 @@ _mesa_HashDeleteAll(struct _mesa_HashTable *table,
for (entry = table->Table[pos]; entry; entry = next) {
callback(entry->Key, entry->Data, userData);
next = entry->Next;
_mesa_free(entry);
free(entry);
}
table->Table[pos] = NULL;
}

View file

@ -1038,7 +1038,7 @@ _mesa_unpack_polygon_stipple( const GLubyte *pattern, GLuint dest[32],
| (p[3] );
p += 4;
}
_mesa_free(ptrn);
free(ptrn);
}
}
@ -1083,7 +1083,7 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
/* Alloc dest storage */
bytes = ((width + 7) / 8 * height);
buffer = (GLubyte *) _mesa_malloc( bytes );
buffer = (GLubyte *) malloc( bytes );
if (!buffer)
return NULL;
@ -1094,7 +1094,7 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
_mesa_image_address2d(packing, pixels, width, height,
GL_COLOR_INDEX, GL_BITMAP, row, 0);
if (!src) {
_mesa_free(buffer);
free(buffer);
return NULL;
}
@ -5232,7 +5232,7 @@ _mesa_unpack_image( GLuint dimensions,
{
GLubyte *destBuffer
= (GLubyte *) _mesa_malloc(bytesPerRow * height * depth);
= (GLubyte *) malloc(bytesPerRow * height * depth);
GLubyte *dst;
GLint img, row;
if (!destBuffer)

View file

@ -71,27 +71,6 @@ extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg);
/** \name Memory */
/*@{*/
/** Wrapper around malloc() */
void *
_mesa_malloc(size_t bytes)
{
return malloc(bytes);
}
/** Wrapper around calloc() */
void *
_mesa_calloc(size_t bytes)
{
return calloc(1, bytes);
}
/** Wrapper around free() */
void
_mesa_free(void *ptr)
{
free(ptr);
}
/**
* Allocate aligned memory.
*
@ -118,7 +97,7 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment)
ASSERT( alignment > 0 );
ptr = (uintptr_t) _mesa_malloc(bytes + alignment + sizeof(void *));
ptr = (uintptr_t) malloc(bytes + alignment + sizeof(void *));
if (!ptr)
return NULL;
@ -138,8 +117,8 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment)
}
/**
* Same as _mesa_align_malloc(), but using _mesa_calloc() instead of
* _mesa_malloc()
* Same as _mesa_align_malloc(), but using calloc(1, ) instead of
* malloc()
*/
void *
_mesa_align_calloc(size_t bytes, unsigned long alignment)
@ -167,7 +146,7 @@ _mesa_align_calloc(size_t bytes, unsigned long alignment)
ASSERT( alignment > 0 );
ptr = (uintptr_t) _mesa_calloc(bytes + alignment + sizeof(void *));
ptr = (uintptr_t) calloc(1, bytes + alignment + sizeof(void *));
if (!ptr)
return NULL;
@ -203,7 +182,7 @@ _mesa_align_free(void *ptr)
#else
void **cubbyHole = (void **) ((char *) ptr - sizeof(void *));
void *realAddr = *cubbyHole;
_mesa_free(realAddr);
free(realAddr);
#endif /* defined(HAVE_POSIX_MEMALIGN) */
}
@ -236,11 +215,11 @@ void *
_mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize)
{
const size_t copySize = (oldSize < newSize) ? oldSize : newSize;
void *newBuffer = _mesa_malloc(newSize);
void *newBuffer = malloc(newSize);
if (newBuffer && oldBuffer && copySize > 0)
memcpy(newBuffer, oldBuffer, copySize);
if (oldBuffer)
_mesa_free(oldBuffer);
free(oldBuffer);
return newBuffer;
}
@ -798,7 +777,7 @@ _mesa_getenv( const char *var )
/*@{*/
/**
* Implemented using _mesa_malloc() and strcpy.
* Implemented using malloc() and strcpy.
* Note that NULL is handled accordingly.
*/
char *
@ -806,7 +785,7 @@ _mesa_strdup( const char *s )
{
if (s) {
size_t l = strlen(s);
char *s2 = (char *) _mesa_malloc(l + 1);
char *s2 = (char *) malloc(l + 1);
if (s2)
strcpy(s2, s);
return s2;

View file

@ -50,15 +50,15 @@ extern "C" {
/*@{*/
/** Allocate \p BYTES bytes */
#define MALLOC(BYTES) _mesa_malloc(BYTES)
#define MALLOC(BYTES) malloc(BYTES)
/** Allocate and zero \p BYTES bytes */
#define CALLOC(BYTES) _mesa_calloc(BYTES)
#define CALLOC(BYTES) calloc(1, BYTES)
/** Allocate a structure of type \p T */
#define MALLOC_STRUCT(T) (struct T *) _mesa_malloc(sizeof(struct T))
#define MALLOC_STRUCT(T) (struct T *) malloc(sizeof(struct T))
/** Allocate and zero a structure of type \p T */
#define CALLOC_STRUCT(T) (struct T *) _mesa_calloc(sizeof(struct T))
#define CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))
/** Free memory */
#define FREE(PTR) _mesa_free(PTR)
#define FREE(PTR) free(PTR)
/** Allocate \p BYTES aligned at \p N bytes */
#define ALIGN_MALLOC(BYTES, N) _mesa_align_malloc(BYTES, N)
@ -507,15 +507,6 @@ _mesa_little_endian(void)
* Functions
*/
extern void *
_mesa_malloc( size_t bytes );
extern void *
_mesa_calloc( size_t bytes );
extern void
_mesa_free( void *ptr );
extern void *
_mesa_align_malloc( size_t bytes, unsigned long alignment );

View file

@ -1433,7 +1433,7 @@ _mesa_free_lighting_data( GLcontext *ctx )
/* Free lighting shininess exponentiation table */
foreach_s( s, tmps, ctx->_ShineTabList ) {
_mesa_free( s );
free( s );
}
_mesa_free( ctx->_ShineTabList );
free( ctx->_ShineTabList );
}

View file

@ -1537,15 +1537,15 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
size = _mesa_bytes_per_pixel(srcImage->_BaseFormat, CHAN_TYPE)
* srcImage->Width * srcImage->Height * srcImage->Depth + 20;
/* 20 extra bytes, just be safe when calling last FetchTexel */
srcData = (GLubyte *) _mesa_malloc(size);
srcData = (GLubyte *) malloc(size);
if (!srcData) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
return;
}
dstData = (GLubyte *) _mesa_malloc(size / 2); /* 1/4 would probably be OK */
dstData = (GLubyte *) malloc(size / 2); /* 1/4 would probably be OK */
if (!dstData) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "generate mipmaps");
_mesa_free((void *) srcData);
free((void *) srcData);
return;
}
@ -1590,8 +1590,8 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target,
if (!nextLevel) {
/* all done */
if (_mesa_is_format_compressed(srcImage->TexFormat)) {
_mesa_free((void *) srcData);
_mesa_free(dstData);
free((void *) srcData);
free(dstData);
}
return;
}

View file

@ -60,13 +60,13 @@ mmInit(unsigned ofs, unsigned size)
if (!size)
return NULL;
heap = (struct mem_block *) _mesa_calloc(sizeof(struct mem_block));
heap = (struct mem_block *) calloc(1, sizeof(struct mem_block));
if (!heap)
return NULL;
block = (struct mem_block *) _mesa_calloc(sizeof(struct mem_block));
block = (struct mem_block *) calloc(1, sizeof(struct mem_block));
if (!block) {
_mesa_free(heap);
free(heap);
return NULL;
}
@ -98,7 +98,7 @@ SliceBlock(struct mem_block *p,
/* break left [p, newblock, p->next], then p = newblock */
if (startofs > p->ofs) {
newblock = (struct mem_block*) _mesa_calloc(sizeof(struct mem_block));
newblock = (struct mem_block*) calloc(1, sizeof(struct mem_block));
if (!newblock)
return NULL;
newblock->ofs = startofs;
@ -122,7 +122,7 @@ SliceBlock(struct mem_block *p,
/* break right, also [p, newblock, p->next] */
if (size < p->size) {
newblock = (struct mem_block*) _mesa_calloc(sizeof(struct mem_block));
newblock = (struct mem_block*) calloc(1, sizeof(struct mem_block));
if (!newblock)
return NULL;
newblock->ofs = startofs + size;
@ -225,7 +225,7 @@ Join2Blocks(struct mem_block *p)
q->next_free->prev_free = q->prev_free;
q->prev_free->next_free = q->next_free;
_mesa_free(q);
free(q);
return 1;
}
return 0;
@ -270,9 +270,9 @@ mmDestroy(struct mem_block *heap)
for (p = heap->next; p != heap; ) {
struct mem_block *next = p->next;
_mesa_free(p);
free(p);
p = next;
}
_mesa_free(heap);
free(heap);
}

View file

@ -114,7 +114,7 @@ _mesa_check_query(GLcontext *ctx, struct gl_query_object *q)
static void
_mesa_delete_query(GLcontext *ctx, struct gl_query_object *q)
{
_mesa_free(q);
free(q);
}

View file

@ -1122,7 +1122,7 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb,
/* free old buffer storage */
if (rb->Data) {
_mesa_free(rb->Data);
free(rb->Data);
rb->Data = NULL;
}
@ -1179,10 +1179,10 @@ alloc_storage_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb,
/* next, resize my alpha buffer */
if (arb->Data) {
_mesa_free(arb->Data);
free(arb->Data);
}
arb->Data = _mesa_malloc(width * height * sizeof(GLubyte));
arb->Data = malloc(width * height * sizeof(GLubyte));
if (arb->Data == NULL) {
arb->Width = 0;
arb->Height = 0;
@ -1204,13 +1204,13 @@ static void
delete_renderbuffer_alpha8(struct gl_renderbuffer *arb)
{
if (arb->Data) {
_mesa_free(arb->Data);
free(arb->Data);
}
ASSERT(arb->Wrapped);
ASSERT(arb != arb->Wrapped);
arb->Wrapped->Delete(arb->Wrapped);
arb->Wrapped = NULL;
_mesa_free(arb);
free(arb);
}
@ -1460,9 +1460,9 @@ void
_mesa_delete_renderbuffer(struct gl_renderbuffer *rb)
{
if (rb->Data) {
_mesa_free(rb->Data);
free(rb->Data);
}
_mesa_free(rb);
free(rb);
}

View file

@ -434,7 +434,7 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count,
* This array holds offsets of where the appropriate string ends, thus the
* last element will be set to the total length of the source code.
*/
offsets = (GLint *) _mesa_malloc(count * sizeof(GLint));
offsets = (GLint *) malloc(count * sizeof(GLint));
if (offsets == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");
return;
@ -442,7 +442,7 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count,
for (i = 0; i < count; i++) {
if (string[i] == NULL) {
_mesa_free((GLvoid *) offsets);
free((GLvoid *) offsets);
_mesa_error(ctx, GL_INVALID_OPERATION, "glShaderSourceARB(null string)");
return;
}
@ -460,9 +460,9 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count,
* valgrind warnings in the parser/grammer code.
*/
totalLength = offsets[count - 1] + 2;
source = (GLcharARB *) _mesa_malloc(totalLength * sizeof(GLcharARB));
source = (GLcharARB *) malloc(totalLength * sizeof(GLcharARB));
if (source == NULL) {
_mesa_free((GLvoid *) offsets);
free((GLvoid *) offsets);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");
return;
}
@ -491,7 +491,7 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count,
if (newSource) {
_mesa_fprintf(stderr, "Mesa: Replacing shader %u chksum=%d with %s\n",
shaderObj, checksum, filename);
_mesa_free(source);
free(source);
source = newSource;
}
}
@ -504,7 +504,7 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count,
sh->SourceChecksum = checksum; /* save original checksum */
}
_mesa_free(offsets);
free(offsets);
}

View file

@ -362,7 +362,7 @@ free_shared_state(GLcontext *ctx, struct gl_shared_state *shared)
_glthread_DESTROY_MUTEX(shared->Mutex);
_glthread_DESTROY_MUTEX(shared->TexMutex);
_mesa_free(shared);
free(shared);
}

View file

@ -78,7 +78,7 @@ static void
_mesa_delete_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj)
{
(void) ctx;
_mesa_free(syncObj);
free(syncObj);
}

View file

@ -105,7 +105,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS)
dst, dstRowStride);
if (tempImage)
_mesa_free((void*) tempImage);
free((void*) tempImage);
return GL_TRUE;
}
@ -162,7 +162,7 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS)
dst, dstRowStride);
if (tempImage)
_mesa_free((void*) tempImage);
free((void*) tempImage);
return GL_TRUE;
}
@ -1305,7 +1305,7 @@ fxt1_encode (GLuint width, GLuint height, GLint comps,
if ((width & 7) | (height & 3)) {
GLint newWidth = (width + 7) & ~7;
GLint newHeight = (height + 3) & ~3;
newSource = _mesa_malloc(comps * newWidth * newHeight * sizeof(GLchan));
newSource = malloc(comps * newWidth * newHeight * sizeof(GLchan));
if (!newSource) {
GET_CURRENT_CONTEXT(ctx);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "texture compression");
@ -1324,7 +1324,7 @@ fxt1_encode (GLuint width, GLuint height, GLint comps,
if (CHAN_TYPE != GL_UNSIGNED_BYTE) {
const GLuint n = width * height * comps;
const GLchan *src = (const GLchan *) source;
GLubyte *dest = (GLubyte *) _mesa_malloc(n * sizeof(GLubyte));
GLubyte *dest = (GLubyte *) malloc(n * sizeof(GLubyte));
GLuint i;
if (!dest) {
GET_CURRENT_CONTEXT(ctx);
@ -1335,7 +1335,7 @@ fxt1_encode (GLuint width, GLuint height, GLint comps,
dest[i] = CHAN_TO_UBYTE(src[i]);
}
if (newSource != NULL) {
_mesa_free(newSource);
free(newSource);
}
newSource = dest; /* we'll free this buffer before returning */
source = dest; /* the new, GLubyte incoming image */
@ -1361,7 +1361,7 @@ fxt1_encode (GLuint width, GLuint height, GLint comps,
cleanUp:
if (newSource != NULL) {
_mesa_free(newSource);
free(newSource);
}
}

View file

@ -213,7 +213,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS)
}
if (tempImage)
_mesa_free((void *) tempImage);
free((void *) tempImage);
return GL_TRUE;
}
@ -275,7 +275,7 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS)
}
if (tempImage)
_mesa_free((void*) tempImage);
free((void*) tempImage);
return GL_TRUE;
}
@ -336,7 +336,7 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS)
}
if (tempImage)
_mesa_free((void *) tempImage);
free((void *) tempImage);
return GL_TRUE;
}
@ -397,7 +397,7 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS)
}
if (tempImage)
_mesa_free((void *) tempImage);
free((void *) tempImage);
return GL_TRUE;
}

View file

@ -488,8 +488,8 @@ _mesa_delete_texture_image( GLcontext *ctx, struct gl_texture_image *texImage )
ASSERT(texImage->Data == NULL);
if (texImage->ImageOffsets)
_mesa_free(texImage->ImageOffsets);
_mesa_free(texImage);
free(texImage->ImageOffsets);
free(texImage);
}
@ -843,7 +843,7 @@ clear_teximage_fields(struct gl_texture_image *img)
img->Depth = 0;
img->RowStride = 0;
if (img->ImageOffsets) {
_mesa_free(img->ImageOffsets);
free(img->ImageOffsets);
img->ImageOffsets = NULL;
}
img->Width2 = 0;
@ -932,8 +932,8 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target,
* case code in the texstore routines.
*/
if (img->ImageOffsets)
_mesa_free(img->ImageOffsets);
img->ImageOffsets = (GLuint *) _mesa_malloc(depth * sizeof(GLuint));
free(img->ImageOffsets);
img->ImageOffsets = (GLuint *) malloc(depth * sizeof(GLuint));
for (i = 0; i < depth; i++) {
img->ImageOffsets[i] = i * width * height;
}

View file

@ -207,7 +207,7 @@ _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj )
_glthread_DESTROY_MUTEX(texObj->Mutex);
/* free this object */
_mesa_free(texObj);
free(texObj);
}

View file

@ -414,7 +414,7 @@ static void
delete_texture_wrapper(struct gl_renderbuffer *rb)
{
ASSERT(rb->RefCount == 0);
_mesa_free(rb);
free(rb);
}

View file

@ -347,16 +347,16 @@ make_temp_float_image(GLcontext *ctx, GLuint dims,
GLfloat *convImage;
/* pre-convolution image buffer (3D) */
tempImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight * srcDepth
tempImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth
* 4 * sizeof(GLfloat));
if (!tempImage)
return NULL;
/* post-convolution image buffer (2D) */
convImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight
convImage = (GLfloat *) malloc(srcWidth * srcHeight
* 4 * sizeof(GLfloat));
if (!convImage) {
_mesa_free(tempImage);
free(tempImage);
return NULL;
}
@ -419,7 +419,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims,
}
} /* loop over 3D image slices */
_mesa_free(convImage);
free(convImage);
/* might need these below */
srcWidth = convWidth;
@ -433,7 +433,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims,
GLfloat *dst;
GLint img, row;
tempImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight * srcDepth
tempImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth
* components * sizeof(GLfloat));
if (!tempImage)
return NULL;
@ -472,10 +472,10 @@ make_temp_float_image(GLcontext *ctx, GLuint dims,
*/
ASSERT(texComponents >= logComponents);
newImage = (GLfloat *) _mesa_malloc(srcWidth * srcHeight * srcDepth
newImage = (GLfloat *) malloc(srcWidth * srcHeight * srcDepth
* texComponents * sizeof(GLfloat));
if (!newImage) {
_mesa_free(tempImage);
free(tempImage);
return NULL;
}
@ -495,7 +495,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims,
}
}
_mesa_free(tempImage);
free(tempImage);
tempImage = newImage;
}
@ -582,11 +582,11 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
#endif
/* unpack and transfer the source image */
tempImage = (GLchan *) _mesa_malloc(srcWidth * srcHeight * srcDepth
tempImage = (GLchan *) malloc(srcWidth * srcHeight * srcDepth
* components * sizeof(GLchan));
if (!tempImage) {
if (freeSrcImage) {
_mesa_free((void *) srcAddr);
free((void *) srcAddr);
}
return NULL;
}
@ -611,7 +611,7 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
/* If we made a temporary image for convolution, free it here */
if (freeSrcImage) {
_mesa_free((void *) srcAddr);
free((void *) srcAddr);
}
if (logicalBaseFormat != textureBaseFormat) {
@ -631,10 +631,10 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
*/
ASSERT(texComponents >= logComponents);
newImage = (GLchan *) _mesa_malloc(srcWidth * srcHeight * srcDepth
newImage = (GLchan *) malloc(srcWidth * srcHeight * srcDepth
* texComponents * sizeof(GLchan));
if (!newImage) {
_mesa_free(tempImage);
free(tempImage);
return NULL;
}
@ -654,7 +654,7 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims,
}
}
_mesa_free(tempImage);
free(tempImage);
tempImage = newImage;
}
@ -1267,7 +1267,7 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS)
dstRow += dstRowStride;
}
}
_mesa_free((void *) tempImage);
free((void *) tempImage);
}
return GL_TRUE;
}
@ -1395,7 +1395,7 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS)
dstRow += dstRowStride;
}
}
_mesa_free((void *) tempImage);
free((void *) tempImage);
}
return GL_TRUE;
}
@ -1606,7 +1606,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS)
dstRow += dstRowStride;
}
}
_mesa_free((void *) tempImage);
free((void *) tempImage);
}
return GL_TRUE;
}
@ -1733,7 +1733,7 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS)
dstRow += dstRowStride;
}
}
_mesa_free((void *) tempImage);
free((void *) tempImage);
}
return GL_TRUE;
}
@ -1841,7 +1841,7 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS)
dstRow += dstRowStride;
}
}
_mesa_free((void *) tempImage);
free((void *) tempImage);
}
return GL_TRUE;
}
@ -1912,7 +1912,7 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS)
dstRow += dstRowStride;
}
}
_mesa_free((void *) tempImage);
free((void *) tempImage);
}
return GL_TRUE;
}
@ -1970,7 +1970,7 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS)
dstRow += dstRowStride;
}
}
_mesa_free((void *) tempImage);
free((void *) tempImage);
}
return GL_TRUE;
}
@ -2040,7 +2040,7 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS)
dstRow += dstRowStride;
}
}
_mesa_free((void *) tempImage);
free((void *) tempImage);
}
return GL_TRUE;
}
@ -2143,7 +2143,7 @@ _mesa_texstore_al88(TEXSTORE_PARAMS)
dstRow += dstRowStride;
}
}
_mesa_free((void *) tempImage);
free((void *) tempImage);
}
return GL_TRUE;
}
@ -2218,7 +2218,7 @@ _mesa_texstore_al1616(TEXSTORE_PARAMS)
dstRow += dstRowStride;
}
}
_mesa_free((void *) tempImage);
free((void *) tempImage);
}
return GL_TRUE;
}
@ -2273,7 +2273,7 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS)
dstRow += dstRowStride;
}
}
_mesa_free((void *) tempImage);
free((void *) tempImage);
}
return GL_TRUE;
}
@ -2360,7 +2360,7 @@ _mesa_texstore_a8(TEXSTORE_PARAMS)
src += srcWidth;
}
}
_mesa_free((void *) tempImage);
free((void *) tempImage);
}
return GL_TRUE;
}
@ -2518,7 +2518,7 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS)
GLbyte *tempImage, *dst, *src;
GLint row;
tempImage = (GLbyte *) _mesa_malloc(srcWidth * srcHeight * srcDepth
tempImage = (GLbyte *) malloc(srcWidth * srcHeight * srcDepth
* components * sizeof(GLbyte));
if (!tempImage)
return GL_FALSE;
@ -2546,7 +2546,7 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS)
dst += dstRowStride;
src += srcWidth * texelBytes;
}
_mesa_free((void *) tempImage);
free((void *) tempImage);
}
return GL_TRUE;
}
@ -2667,7 +2667,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS)
dstRow += dstRowStride;
}
}
_mesa_free((void *) tempImage);
free((void *) tempImage);
}
return GL_TRUE;
}
@ -2925,7 +2925,7 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS)
}
}
_mesa_free((void *) tempImage);
free((void *) tempImage);
}
return GL_TRUE;
}
@ -2996,7 +2996,7 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS)
}
}
_mesa_free((void *) tempImage);
free((void *) tempImage);
}
return GL_TRUE;
}

View file

@ -122,7 +122,7 @@ _mesa_compute_version(GLcontext *ctx)
compute_version(ctx, &ctx->VersionMajor, &ctx->VersionMinor);
ctx->VersionString = (char *) _mesa_malloc(max);
ctx->VersionString = (char *) malloc(max);
if (ctx->VersionString) {
_mesa_snprintf(ctx->VersionString, max, "%u.%u Mesa " MESA_VERSION_STRING,
ctx->VersionMajor, ctx->VersionMinor);

View file

@ -85,7 +85,7 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target,
}
if (program->Base.String != NULL)
_mesa_free(program->Base.String);
free(program->Base.String);
/* Copy the relevant contents of the arb_program struct into the
* fragment_program struct.
@ -130,7 +130,7 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target,
program->Base.InputsRead |= FRAG_BIT_FOGC;
if (program->Base.Instructions)
_mesa_free(program->Base.Instructions);
free(program->Base.Instructions);
program->Base.Instructions = prog.Instructions;
if (program->Base.Parameters)
@ -181,7 +181,7 @@ _mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target,
}
if (program->Base.String != NULL)
_mesa_free(program->Base.String);
free(program->Base.String);
/* Copy the relevant contents of the arb_program struct into the
* vertex_program struct.
@ -203,7 +203,7 @@ _mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target,
? GL_TRUE : GL_FALSE;
if (program->Base.Instructions)
_mesa_free(program->Base.Instructions);
free(program->Base.Instructions);
program->Base.Instructions = prog.Instructions;
if (program->Base.Parameters)

View file

@ -60,11 +60,11 @@ _mesa_delete_ati_fragment_shader(GLcontext *ctx, struct ati_fragment_shader *s)
GLuint i;
for (i = 0; i < MAX_NUM_PASSES_ATI; i++) {
if (s->Instructions[i])
_mesa_free(s->Instructions[i]);
free(s->Instructions[i]);
if (s->SetupInst[i])
_mesa_free(s->SetupInst[i]);
free(s->SetupInst[i]);
}
_mesa_free(s);
free(s);
}
@ -293,7 +293,7 @@ _mesa_DeleteFragmentShaderATI(GLuint id)
if (prog) {
prog->RefCount--;
if (prog->RefCount <= 0) {
_mesa_free(prog);
free(prog);
}
}
}
@ -318,9 +318,9 @@ _mesa_BeginFragmentShaderATI(void)
/* no idea if it's allowed to redefine a shader */
for (i = 0; i < MAX_NUM_PASSES_ATI; i++) {
if (ctx->ATIFragmentShader.Current->Instructions[i])
_mesa_free(ctx->ATIFragmentShader.Current->Instructions[i]);
free(ctx->ATIFragmentShader.Current->Instructions[i]);
if (ctx->ATIFragmentShader.Current->SetupInst[i])
_mesa_free(ctx->ATIFragmentShader.Current->SetupInst[i]);
free(ctx->ATIFragmentShader.Current->SetupInst[i]);
}
/* malloc the instructions here - not sure if the best place but its
@ -328,11 +328,11 @@ _mesa_BeginFragmentShaderATI(void)
for (i = 0; i < MAX_NUM_PASSES_ATI; i++) {
ctx->ATIFragmentShader.Current->Instructions[i] =
(struct atifs_instruction *)
_mesa_calloc(sizeof(struct atifs_instruction) *
calloc(1, sizeof(struct atifs_instruction) *
(MAX_NUM_INSTRUCTIONS_PER_PASS_ATI));
ctx->ATIFragmentShader.Current->SetupInst[i] =
(struct atifs_setupinst *)
_mesa_calloc(sizeof(struct atifs_setupinst) *
calloc(1, sizeof(struct atifs_setupinst) *
(MAX_NUM_FRAGMENT_REGISTERS_ATI));
}

View file

@ -65,7 +65,7 @@ hash_table_ctor(unsigned num_buckets, hash_func_t hash,
num_buckets = 16;
}
ht = _mesa_malloc(sizeof(*ht) + ((num_buckets - 1)
ht = malloc(sizeof(*ht) + ((num_buckets - 1)
* sizeof(ht->buckets[0])));
if (ht != NULL) {
ht->hash = hash;
@ -85,7 +85,7 @@ void
hash_table_dtor(struct hash_table *ht)
{
hash_table_clear(ht);
_mesa_free(ht);
free(ht);
}
@ -100,7 +100,7 @@ hash_table_clear(struct hash_table *ht)
for (i = 0; i < ht->num_buckets; i++) {
foreach_s(node, temp, & ht->buckets[i]) {
remove_from_list(node);
_mesa_free(node);
free(node);
}
assert(is_empty_list(& ht->buckets[i]));
@ -134,7 +134,7 @@ hash_table_insert(struct hash_table *ht, void *data, const void *key)
const unsigned bucket = hash_value % ht->num_buckets;
struct hash_node *node;
node = _mesa_calloc(sizeof(*node));
node = calloc(1, sizeof(*node));
node->data = data;
node->key = key;

View file

@ -171,7 +171,7 @@ record_error(struct parse_state *parseState, const char *msg, int lineNo)
_mesa_debug(parseState->ctx,
"nvfragparse.c(%d): line %d, column %d:%s (%s)\n",
lineNo, line, column, (char *) lineStr, msg);
_mesa_free((void *) lineStr);
free((void *) lineStr);
#else
(void) lineNo;
#endif
@ -1231,7 +1231,7 @@ Parse_PrintInstruction(struct parse_state *parseState,
for (len = 0; str[len] != '\''; len++) /* find closing quote */
;
parseState->pos += len + 1;
msg = (GLubyte*) _mesa_malloc(len + 1);
msg = (GLubyte*) malloc(len + 1);
memcpy(msg, str, len);
msg[len] = 0;
@ -1548,7 +1548,7 @@ _mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum dstTarget,
program->Base.String = programString;
program->Base.Format = GL_PROGRAM_FORMAT_ASCII_ARB;
if (program->Base.Instructions) {
_mesa_free(program->Base.Instructions);
free(program->Base.Instructions);
}
program->Base.Instructions = newInst;
program->Base.NumInstructions = parseState.numInst;

View file

@ -82,7 +82,7 @@ record_error(struct parse_state *parseState, const char *msg, int lineNo)
_mesa_debug(parseState->ctx,
"nvfragparse.c(%d): line %d, column %d:%s (%s)\n",
lineNo, line, column, (char *) lineStr, msg);
_mesa_free((void *) lineStr);
free((void *) lineStr);
#else
(void) lineNo;
#endif
@ -1048,7 +1048,7 @@ Parse_PrintInstruction(struct parse_state *parseState, struct prog_instruction *
for (len = 0; str[len] != '\''; len++) /* find closing quote */
;
parseState->pos += len + 1;
msg = (GLubyte*) _mesa_malloc(len + 1);
msg = (GLubyte*) malloc(len + 1);
memcpy(msg, str, len);
msg[len] = 0;
@ -1372,7 +1372,7 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget,
newInst = _mesa_alloc_instructions(parseState.numInst);
if (!newInst) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV");
_mesa_free(programString);
free(programString);
return; /* out of memory */
}
_mesa_copy_instructions(newInst, instBuffer, parseState.numInst);
@ -1380,12 +1380,12 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget,
/* install the program */
program->Base.Target = target;
if (program->Base.String) {
_mesa_free(program->Base.String);
free(program->Base.String);
}
program->Base.String = programString;
program->Base.Format = GL_PROGRAM_FORMAT_ASCII_ARB;
if (program->Base.Instructions) {
_mesa_free(program->Base.Instructions);
free(program->Base.Instructions);
}
program->Base.Instructions = newInst;
program->Base.InputsRead = parseState.inputsRead;

View file

@ -87,7 +87,7 @@ rehash(struct gl_program_cache *cache)
cache->last = NULL;
size = cache->size * 3;
items = (struct cache_item**) _mesa_malloc(size * sizeof(*items));
items = (struct cache_item**) malloc(size * sizeof(*items));
memset(items, 0, size * sizeof(*items));
for (i = 0; i < cache->size; i++)
@ -97,7 +97,7 @@ rehash(struct gl_program_cache *cache)
items[c->hash % size] = c;
}
_mesa_free(cache->items);
free(cache->items);
cache->items = items;
cache->size = size;
}
@ -114,9 +114,9 @@ clear_cache(GLcontext *ctx, struct gl_program_cache *cache)
for (i = 0; i < cache->size; i++) {
for (c = cache->items[i]; c; c = next) {
next = c->next;
_mesa_free(c->key);
free(c->key);
_mesa_reference_program(ctx, &c->program, NULL);
_mesa_free(c);
free(c);
}
cache->items[i] = NULL;
}
@ -134,9 +134,9 @@ _mesa_new_program_cache(void)
if (cache) {
cache->size = 17;
cache->items = (struct cache_item **)
_mesa_calloc(cache->size * sizeof(struct cache_item));
calloc(1, cache->size * sizeof(struct cache_item));
if (!cache->items) {
_mesa_free(cache);
free(cache);
return NULL;
}
}
@ -148,8 +148,8 @@ void
_mesa_delete_program_cache(GLcontext *ctx, struct gl_program_cache *cache)
{
clear_cache(ctx, cache);
_mesa_free(cache->items);
_mesa_free(cache);
free(cache->items);
free(cache);
}
@ -188,7 +188,7 @@ _mesa_program_cache_insert(GLcontext *ctx,
c->hash = hash;
c->key = _mesa_malloc(keysize);
c->key = malloc(keysize);
memcpy(c->key, key, keysize);
c->program = program; /* no refcount change */

View file

@ -70,7 +70,7 @@ struct prog_instruction *
_mesa_alloc_instructions(GLuint numInst)
{
return (struct prog_instruction *)
_mesa_calloc(numInst * sizeof(struct prog_instruction));
calloc(1, numInst * sizeof(struct prog_instruction));
}
@ -128,11 +128,11 @@ _mesa_free_instructions(struct prog_instruction *inst, GLuint count)
GLuint i;
for (i = 0; i < count; i++) {
if (inst[i].Data)
_mesa_free(inst[i].Data);
free(inst[i].Data);
if (inst[i].Comment)
_mesa_free((char *) inst[i].Comment);
free((char *) inst[i].Comment);
}
_mesa_free(inst);
free(inst);
}

View file

@ -237,7 +237,7 @@ _mesa_remove_dead_code(struct gl_program *prog)
}
removeInst = (GLboolean *)
_mesa_calloc(prog->NumInstructions * sizeof(GLboolean));
calloc(1, prog->NumInstructions * sizeof(GLboolean));
/* Determine which temps are read and written */
for (i = 0; i < prog->NumInstructions; i++) {
@ -347,7 +347,7 @@ _mesa_remove_dead_code(struct gl_program *prog)
}
done:
_mesa_free(removeInst);
free(removeInst);
}
@ -538,7 +538,7 @@ _mesa_remove_extra_moves(struct gl_program *prog)
}
removeInst = (GLboolean *)
_mesa_calloc(prog->NumInstructions * sizeof(GLboolean));
calloc(1, prog->NumInstructions * sizeof(GLboolean));
/*
* Look for sequences such as this:
@ -621,7 +621,7 @@ _mesa_remove_extra_moves(struct gl_program *prog)
/* now remove the instructions which aren't needed */
rem = remove_instructions(prog, removeInst);
_mesa_free(removeInst);
free(removeInst);
if (dbg) {
_mesa_printf("Optimize: End remove extra moves. %u instructions removed\n", rem);

View file

@ -54,16 +54,16 @@ _mesa_new_parameter_list_sized(unsigned size)
/* alloc arrays */
p->Parameters = (struct gl_program_parameter *)
_mesa_calloc(size * sizeof(struct gl_program_parameter));
calloc(1, size * sizeof(struct gl_program_parameter));
p->ParameterValues = (GLfloat (*)[4])
_mesa_align_malloc(size * 4 *sizeof(GLfloat), 16);
if ((p->Parameters == NULL) || (p->ParameterValues == NULL)) {
_mesa_free(p->Parameters);
free(p->Parameters);
_mesa_align_free(p->ParameterValues);
_mesa_free(p);
free(p);
p = NULL;
}
}
@ -81,12 +81,12 @@ _mesa_free_parameter_list(struct gl_program_parameter_list *paramList)
GLuint i;
for (i = 0; i < paramList->NumParameters; i++) {
if (paramList->Parameters[i].Name)
_mesa_free((void *) paramList->Parameters[i].Name);
free((void *) paramList->Parameters[i].Name);
}
_mesa_free(paramList->Parameters);
free(paramList->Parameters);
if (paramList->ParameterValues)
_mesa_align_free(paramList->ParameterValues);
_mesa_free(paramList);
free(paramList);
}
@ -486,7 +486,7 @@ _mesa_add_state_reference(struct gl_program_parameter_list *paramList,
paramList->StateFlags |= _mesa_program_state_flags(stateTokens);
/* free name string here since we duplicated it in add_parameter() */
_mesa_free(name);
free(name);
return index;
}

View file

@ -309,7 +309,7 @@ reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode,
= prog->Parameters->Parameters + index;
char *state = _mesa_program_state_string(param->StateIndexes);
_mesa_sprintf(str, state);
_mesa_free(state);
free(state);
}
break;
case PROGRAM_ADDRESS:

View file

@ -957,7 +957,7 @@ append_index(char *dst, GLint index)
/**
* Make a string from the given state vector.
* For example, return "state.matrix.texture[2].inverse".
* Use _mesa_free() to deallocate the string.
* Use free() to deallocate the string.
*/
char *
_mesa_program_state_string(const gl_state_index state[STATE_LENGTH])

View file

@ -45,10 +45,10 @@ _mesa_free_uniform_list(struct gl_uniform_list *list)
{
GLuint i;
for (i = 0; i < list->NumUniforms; i++) {
_mesa_free((void *) list->Uniforms[i].Name);
free((void *) list->Uniforms[i].Name);
}
_mesa_free(list->Uniforms);
_mesa_free(list);
free(list->Uniforms);
free(list);
}

View file

@ -127,11 +127,11 @@ _mesa_free_program_data(GLcontext *ctx)
if (ctx->ATIFragmentShader.Current) {
ctx->ATIFragmentShader.Current->RefCount--;
if (ctx->ATIFragmentShader.Current->RefCount <= 0) {
_mesa_free(ctx->ATIFragmentShader.Current);
free(ctx->ATIFragmentShader.Current);
}
}
#endif
_mesa_free((void *) ctx->Program.ErrorString);
free((void *) ctx->Program.ErrorString);
}
@ -162,7 +162,7 @@ _mesa_update_default_objects_program(GLcontext *ctx)
if (ctx->ATIFragmentShader.Current) {
ctx->ATIFragmentShader.Current->RefCount--;
if (ctx->ATIFragmentShader.Current->RefCount <= 0) {
_mesa_free(ctx->ATIFragmentShader.Current);
free(ctx->ATIFragmentShader.Current);
}
}
ctx->ATIFragmentShader.Current = (struct ati_fragment_shader *) ctx->Shared->DefaultFragmentShader;
@ -180,7 +180,7 @@ void
_mesa_set_program_error(GLcontext *ctx, GLint pos, const char *string)
{
ctx->Program.ErrorPos = pos;
_mesa_free((void *) ctx->Program.ErrorString);
free((void *) ctx->Program.ErrorString);
if (!string)
string = "";
ctx->Program.ErrorString = _mesa_strdup(string);
@ -190,7 +190,7 @@ _mesa_set_program_error(GLcontext *ctx, GLint pos, const char *string)
/**
* Find the line number and column for 'pos' within 'string'.
* Return a copy of the line which contains 'pos'. Free the line with
* _mesa_free().
* free().
* \param string the program string
* \param pos the position within the string
* \param line returns the line number corresponding to 'pos'.
@ -222,7 +222,7 @@ _mesa_find_line_column(const GLubyte *string, const GLubyte *pos,
while (*p != 0 && *p != '\n')
p++;
len = p - lineStart;
s = (GLubyte *) _mesa_malloc(len + 1);
s = (GLubyte *) malloc(len + 1);
memcpy(s, lineStart, len);
s[len] = 0;
@ -337,7 +337,7 @@ _mesa_delete_program(GLcontext *ctx, struct gl_program *prog)
return;
if (prog->String)
_mesa_free(prog->String);
free(prog->String);
_mesa_free_instructions(prog->Instructions, prog->NumInstructions);
@ -351,7 +351,7 @@ _mesa_delete_program(GLcontext *ctx, struct gl_program *prog)
_mesa_free_parameter_list(prog->Attributes);
}
_mesa_free(prog);
free(prog);
}

View file

@ -3140,7 +3140,7 @@ yyreduce:
? err_str : "invalid condition code");
if (err_str != NULL) {
_mesa_free(err_str);
free(err_str);
}
YYERROR;
@ -3166,7 +3166,7 @@ yyreduce:
? err_str : "invalid condition code");
if (err_str != NULL) {
_mesa_free(err_str);
free(err_str);
}
YYERROR;
@ -4547,7 +4547,7 @@ yyreduce:
? err_str : "invalid storage size specifier");
if (err_str != NULL) {
_mesa_free(err_str);
free(err_str);
}
YYERROR;
@ -5403,7 +5403,7 @@ int add_state_reference(struct gl_program_parameter_list *param_list,
param_list->StateFlags |= _mesa_program_state_flags(tokens);
/* free name string here since we duplicated it in add_parameter() */
_mesa_free(name);
free(name);
return index;
}
@ -5568,7 +5568,7 @@ make_error_string(const char *fmt, ...)
*/
length = 1 + vsnprintf(NULL, 0, fmt, args);
str = _mesa_malloc(length);
str = malloc(length);
if (str) {
vsnprintf(str, length, fmt, args);
}
@ -5588,7 +5588,7 @@ yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s)
err_str = make_error_string("glProgramStringARB(%s)\n", s);
if (err_str) {
_mesa_error(state->ctx, GL_INVALID_OPERATION, err_str);
_mesa_free(err_str);
free(err_str);
}
err_str = make_error_string("line %u, char %u: error: %s\n",
@ -5596,7 +5596,7 @@ yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s)
_mesa_set_program_error(state->ctx, locp->position, err_str);
if (err_str) {
_mesa_free(err_str);
free(err_str);
}
}
@ -5618,7 +5618,7 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str,
/* Make a copy of the program string and force it to be NUL-terminated.
*/
strz = (GLubyte *) _mesa_malloc(len + 1);
strz = (GLubyte *) malloc(len + 1);
if (strz == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
return GL_FALSE;
@ -5706,7 +5706,7 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str,
error:
for (inst = state->inst_head; inst != NULL; inst = temp) {
temp = inst->next;
_mesa_free(inst);
free(inst);
}
state->inst_head = NULL;
@ -5715,8 +5715,8 @@ error:
for (sym = state->sym; sym != NULL; sym = temp) {
temp = sym->next;
_mesa_free((void *) sym->name);
_mesa_free(sym);
free((void *) sym->name);
free(sym);
}
state->sym = NULL;

View file

@ -1056,7 +1056,7 @@ ccMaskRule: IDENTIFIER
? err_str : "invalid condition code");
if (err_str != NULL) {
_mesa_free(err_str);
free(err_str);
}
YYERROR;
@ -1079,7 +1079,7 @@ ccMaskRule2: USED_IDENTIFIER
? err_str : "invalid condition code");
if (err_str != NULL) {
_mesa_free(err_str);
free(err_str);
}
YYERROR;
@ -1956,7 +1956,7 @@ optVarSize: string
? err_str : "invalid storage size specifier");
if (err_str != NULL) {
_mesa_free(err_str);
free(err_str);
}
YYERROR;
@ -2442,7 +2442,7 @@ int add_state_reference(struct gl_program_parameter_list *param_list,
param_list->StateFlags |= _mesa_program_state_flags(tokens);
/* free name string here since we duplicated it in add_parameter() */
_mesa_free(name);
free(name);
return index;
}
@ -2607,7 +2607,7 @@ make_error_string(const char *fmt, ...)
*/
length = 1 + vsnprintf(NULL, 0, fmt, args);
str = _mesa_malloc(length);
str = malloc(length);
if (str) {
vsnprintf(str, length, fmt, args);
}
@ -2627,7 +2627,7 @@ yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s)
err_str = make_error_string("glProgramStringARB(%s)\n", s);
if (err_str) {
_mesa_error(state->ctx, GL_INVALID_OPERATION, err_str);
_mesa_free(err_str);
free(err_str);
}
err_str = make_error_string("line %u, char %u: error: %s\n",
@ -2635,7 +2635,7 @@ yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s)
_mesa_set_program_error(state->ctx, locp->position, err_str);
if (err_str) {
_mesa_free(err_str);
free(err_str);
}
}
@ -2657,7 +2657,7 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str,
/* Make a copy of the program string and force it to be NUL-terminated.
*/
strz = (GLubyte *) _mesa_malloc(len + 1);
strz = (GLubyte *) malloc(len + 1);
if (strz == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB");
return GL_FALSE;
@ -2745,7 +2745,7 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str,
error:
for (inst = state->inst_head; inst != NULL; inst = temp) {
temp = inst->next;
_mesa_free(inst);
free(inst);
}
state->inst_head = NULL;
@ -2754,8 +2754,8 @@ error:
for (sym = state->sym; sym != NULL; sym = temp) {
temp = sym->next;
_mesa_free((void *) sym->name);
_mesa_free(sym);
free((void *) sym->name);
free(sym);
}
state->sym = NULL;

View file

@ -115,12 +115,12 @@ _mesa_free_shader_program_data(GLcontext *ctx,
shProg->NumShaders = 0;
if (shProg->Shaders) {
_mesa_free(shProg->Shaders);
free(shProg->Shaders);
shProg->Shaders = NULL;
}
if (shProg->InfoLog) {
_mesa_free(shProg->InfoLog);
free(shProg->InfoLog);
shProg->InfoLog = NULL;
}
}
@ -134,7 +134,7 @@ _mesa_free_shader_program(GLcontext *ctx, struct gl_shader_program *shProg)
{
_mesa_free_shader_program_data(ctx, shProg);
_mesa_free(shProg);
free(shProg);
}
@ -262,11 +262,11 @@ void
_mesa_free_shader(GLcontext *ctx, struct gl_shader *sh)
{
if (sh->Source)
_mesa_free((void *) sh->Source);
free((void *) sh->Source);
if (sh->InfoLog)
_mesa_free(sh->InfoLog);
free(sh->InfoLog);
_mesa_reference_program(ctx, &sh->Program, NULL);
_mesa_free(sh);
free(sh);
}
@ -709,7 +709,7 @@ _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader)
/* alloc new, smaller array */
newList = (struct gl_shader **)
_mesa_malloc((n - 1) * sizeof(struct gl_shader *));
malloc((n - 1) * sizeof(struct gl_shader *));
if (!newList) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDetachShader");
return;
@ -719,7 +719,7 @@ _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader)
}
while (++i < n)
newList[j++] = shProg->Shaders[i];
_mesa_free(shProg->Shaders);
free(shProg->Shaders);
shProg->Shaders = newList;
shProg->NumShaders = n - 1;
@ -1377,7 +1377,7 @@ _mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name)
if (c) {
/* truncate name at [ */
const GLint len = c - name;
GLchar *newName = _mesa_malloc(len + 1);
GLchar *newName = malloc(len + 1);
if (!newName)
return -1; /* out of mem */
memcpy(newName, name, len);
@ -1400,7 +1400,7 @@ _mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name)
}
}
_mesa_free(newName);
free(newName);
}
}
@ -1431,7 +1431,7 @@ _mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source)
/* free old shader source string and install new one */
if (sh->Source) {
_mesa_free((void *) sh->Source);
free((void *) sh->Source);
}
sh->Source = source;
sh->CompileStatus = GL_FALSE;
@ -2155,7 +2155,7 @@ _mesa_validate_program(GLcontext *ctx, GLuint program)
if (!shProg->Validated) {
/* update info log */
if (shProg->InfoLog) {
_mesa_free(shProg->InfoLog);
free(shProg->InfoLog);
}
shProg->InfoLog = _mesa_strdup(errMsg);
}

View file

@ -3639,7 +3639,7 @@ make_constant_array(slang_assemble_ctx *A,
assert(initializer->type == SLANG_OPER_CALL);
assert(initializer->array_constructor);
values = (GLfloat *) _mesa_malloc(numElements * 4 * sizeof(GLfloat));
values = (GLfloat *) malloc(numElements * 4 * sizeof(GLfloat));
/* convert constructor params into ordinary floats */
for (i = 0; i < numElements; i++) {
@ -3670,7 +3670,7 @@ make_constant_array(slang_assemble_ctx *A,
}
assert(var->store->Size == size);
_mesa_free(values);
free(values);
return GL_TRUE;
}
@ -5321,7 +5321,7 @@ _slang_codegen_function(slang_assemble_ctx * A, slang_function * fun)
/* free codegen context */
/*
_mesa_free(A->codegen);
free(A->codegen);
*/
return success;

Some files were not shown because too many files have changed in this diff Show more