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;
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));
}
xmvis = create_glx_visual( dpy, visinfo );
if (!xmvis) {
/* unusable visual */
- _mesa_free(glxCtx);
+ free(glxCtx);
return NULL;
}
}
glxCtx->xmesaContext = XMesaCreateContext(xmvis,
shareCtx ? shareCtx->xmesaContext : NULL);
if (!glxCtx->xmesaContext) {
- _mesa_free(glxCtx);
+ free(glxCtx);
return NULL;
}
MakeCurrent_PrevReadBuffer = 0;
XMesaDestroyContext( glxCtx->xmesaContext );
XMesaGarbageCollect();
- _mesa_free(glxCtx);
+ free(glxCtx);
}
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;
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;
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));
}
glxCtx->xmesaContext = XMesaCreateContext(xmvis,
shareCtx ? shareCtx->xmesaContext : NULL);
if (!glxCtx->xmesaContext) {
- _mesa_free(glxCtx);
+ free(glxCtx);
return NULL;
}
glxCtx->xmesaContext = XMesaCreateContext(xmvis,
shareCtx ? shareCtx->xmesaContext : NULL);
if (!glxCtx->xmesaContext) {
- _mesa_free(glxCtx);
+ free(glxCtx);
return NULL;
}
/* 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;
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));
PUBLIC
void XMesaDestroyVisual( XMesaVisual v )
{
- _mesa_free(v->visinfo);
- _mesa_free(v);
+ free(v->visinfo);
+ free(v);
}
else if (pipe)
pipe->destroy(pipe);
- _mesa_free(c);
+ free(c);
return NULL;
}
screen->destroy(screen);
*/
- _mesa_free(c);
+ free(c);
}
* \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
/**
return GLX_BAD_ATTRIBUTE;
}
}
-#endif /* !defined(IN_MINI_GLX) */
/**
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;
while (modes != NULL) {
__GLcontextModes *const next = modes->next;
- _mesa_free(modes);
+ free(modes);
modes = next;
}
}
#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);
* 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;
}
}
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);
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
mask &= ~GL_DEPTH_BUFFER_BIT;
- _mesa_free(tmp);
+ free(tmp);
}
}
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);
_mesa_set_enable(ctx, tex->Target, GL_FALSE);
- _mesa_free(bitmap8);
+ free(bitmap8);
}
_mesa_unmap_pbo_source(ctx, &unpackSave);
/*
* 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;
_mesa_lock_texture(ctx, texObj); /* re-lock */
- _mesa_free(buf);
+ free(buf);
}
/*
* 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;
_mesa_lock_texture(ctx, texObj); /* re-lock */
- _mesa_free(buf);
+ free(buf);
}
{
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;
_mesa_meta_end(ctx);
- _mesa_free(buf);
+ free(buf);
}
{
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;
_mesa_meta_end(ctx);
- _mesa_free(buf);
+ free(buf);
}
{
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;
_mesa_meta_end(ctx);
- _mesa_free(buf);
+ free(buf);
}
{
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;
_mesa_meta_end(ctx);
- _mesa_free(buf);
+ free(buf);
}
}
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;
}
if (!dPriv->numClipRects)
return;
- rects = _mesa_malloc(sizeof(*rects) * dPriv->numClipRects);
+ rects = malloc(sizeof(*rects) * dPriv->numClipRects);
if (!rects)
return;
}
driReportDamage(dPriv, rects, dPriv->numClipRects);
- _mesa_free(rects);
+ free(rects);
}
static int driDrawableGetMSC( __DRIscreen *sPriv, __DRIdrawable *dPriv,
*/
(void) attrs;
- pdp = _mesa_malloc(sizeof *pdp);
+ pdp = malloc(sizeof *pdp);
if (!pdp) {
return NULL;
}
if (!(*psp->DriverAPI.CreateBuffer)(psp, pdp, &config->modes,
renderType == GLX_PIXMAP_BIT)) {
- _mesa_free(pdp);
+ free(pdp);
return NULL;
}
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);
}
}
{
if (pcp) {
(*pcp->driScreenPriv->DriverAPI.DestroyContext)(pcp);
- _mesa_free(pcp);
+ free(pcp);
}
}
__DRIcontext *pcp;
void * const shareCtx = (shared != NULL) ? shared->driverPrivate : NULL;
- pcp = _mesa_malloc(sizeof *pcp);
+ pcp = malloc(sizeof *pcp);
if (!pcp)
return NULL;
pcp->hHWContext = hwContext;
if ( !(*psp->DriverAPI.CreateContext)(&config->modes, pcp, shareCtx) ) {
- _mesa_free(pcp);
+ free(pcp);
return NULL;
}
(void)drmCloseOnce(psp->fd);
}
- _mesa_free(psp);
+ free(psp);
}
}
static const __DRIextension *emptyExtensionList[] = { NULL };
__DRIscreen *psp;
- psp = _mesa_calloc(sizeof *psp);
+ psp = calloc(1, sizeof *psp);
if (!psp)
return NULL;
*driver_modes = driDriverAPI.InitScreen(psp);
if (*driver_modes == NULL) {
- _mesa_free(psp);
+ free(psp);
return NULL;
}
if (driDriverAPI.InitScreen2 == NULL)
return NULL;
- psp = _mesa_calloc(sizeof(*psp));
+ psp = calloc(1, sizeof(*psp));
if (!psp)
return NULL;
psp->DriverAPI = driDriverAPI;
*driver_configs = driDriverAPI.InitScreen2(psp);
if (*driver_configs == NULL) {
- _mesa_free(psp);
+ free(psp);
return NULL;
}
/* don't free rb->Data Chances are it's a memory mapped region for
* the dri drivers.
*/
- _mesa_free(rb);
+ free(rb);
}
assert(cpp > 0);
assert(pitch > 0);
- drb = _mesa_calloc(sizeof(driRenderbuffer));
+ drb = calloc(1, sizeof(driRenderbuffer));
if (drb) {
const GLuint name = 0;
cpu = _mesa_get_cpu_string();
if (cpu) {
offset += sprintf(buffer + offset, " %s", cpu);
- _mesa_free(cpu);
+ free(cpu);
}
return offset;
}
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;
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++;
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];
all[index++] = b[j];
all[index++] = NULL;
- _mesa_free(a);
- _mesa_free(b);
+ free(a);
+ free(b);
return all;
}
assert(driContextPriv);
/* Allocate the Fb context */
- fbmesa = (fbContextPtr) _mesa_calloc( sizeof(*fbmesa) );
+ fbmesa = (fbContextPtr) calloc(1, sizeof(*fbmesa) );
if ( !fbmesa )
return GL_FALSE;
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;
fbmesa->glCtx->DriverCtx = NULL;
_mesa_destroy_context( fbmesa->glCtx );
- _mesa_free( fbmesa );
+ free( fbmesa );
}
}
}
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,
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 */
offset += currentPitch;
}
- _mesa_free(tmp);
+ free(tmp);
}
}
else {
return;
}
- buf = (GLfloat *) _mesa_calloc(bufsz);
+ buf = (GLfloat *) calloc(1, bufsz);
/* fragment shader constants */
if (brw->curbe.wm_size) {
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;
} 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);
size,
data);
- _mesa_free(data);
+ free(data);
}
}
}
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;
}
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;
}
{
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;
struct brw_query_object *query = (struct brw_query_object *)q;
dri_bo_unreference(query->bo);
- _mesa_free(query);
+ free(query);
}
static void
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;
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;
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) {
/* 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);
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);
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);
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;
}
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++)
*/
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;
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);
}
dri_bo_unreference(intel_obj->buffer);
}
- _mesa_free(intel_obj);
+ free(intel_obj);
}
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) {
* 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);
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,
intel_obj->Base.Size,
sys_buffer,
&intel_obj->Base);
- _mesa_free(sys_buffer);
+ free(sys_buffer);
intel_obj->sys_buffer = NULL;
}
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);
}
default:
_mesa_problem(NULL,
"Unexpected intFormat in intel_create_renderbuffer");
- _mesa_free(irb);
+ free(irb);
return NULL;
}
irb->Base.ClassID = INTEL_RB_CLASS;
if (!intel_update_wrapper(ctx, irb, texImage)) {
- _mesa_free(irb);
+ free(irb);
return NULL;
}
}
/* 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)) {
_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,
/* 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,
_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);
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;
}
{
struct intel_sync_object *sync;
- sync = _mesa_calloc(sizeof(struct intel_sync_object));
+ sync = calloc(1, sizeof(struct intel_sync_object));
return &sync->Base;
}
struct intel_sync_object *sync = (struct intel_sync_object *)s;
drm_intel_bo_unreference(sync->bo);
- _mesa_free(sync);
+ free(sync);
}
static void
fp = fp->next;
}
- fp = _mesa_calloc(sizeof(struct r300_fragment_program));
+ fp = calloc(1, sizeof(struct r300_fragment_program));
fp->state = state;
while (fp) {
tmp = fp->next;
rc_constants_destroy(&fp->code.constants);
- _mesa_free(fp);
+ free(fp);
fp = tmp;
}
}
tmp = vp->next;
rc_constants_destroy(&vp->code.constants);
_mesa_reference_vertprog(ctx, &vp->Base, NULL);
- _mesa_free(vp);
+ free(vp);
vp = tmp;
}
}
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));
Clean_Up_Shader(&(vp->r700Shader));
_mesa_reference_vertprog(ctx, &vp->mesa_program, NULL);
- _mesa_free(vp);
+ free(vp);
vp = tmp;
}
}
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)
radeon_bo_unref(radeon_obj->bo);
}
- _mesa_free(radeon_obj);
+ free(radeon_obj);
}
if (rrb && rrb->bo) {
radeon_bo_unref(rrb->bo);
}
- _mesa_free(rrb);
+ free(rrb);
}
static void *
rrb->base.ClassID = RADEON_RB_CLASS;
if (!radeon_update_wrapper(ctx, rrb, texImage)) {
- _mesa_free(rrb);
+ free(rrb);
return NULL;
}
{
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;
radeon_bo_unref(query->bo);
}
- _mesa_free(query);
+ free(query);
}
static void radeonWaitQuery(GLcontext *ctx, struct gl_query_object *q)
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;
}
if (dims == 3) {
- _mesa_free(dstImageOffsets);
+ free(dstImageOffsets);
}
radeon_teximage_unmap(image);
}
/* Allocate the private area */
- savageScreen = (savageScreenPrivate *)_mesa_malloc(sizeof(savageScreenPrivate));
+ savageScreen = (savageScreenPrivate *)malloc(sizeof(savageScreenPrivate));
if (!savageScreen)
return GL_FALSE;
savageScreen->agpTextures.handle,
savageScreen->agpTextures.size,
(drmAddress *)&(savageScreen->agpTextures.map)) != 0) {
- _mesa_free(savageScreen);
+ free(savageScreen);
sPriv->private = NULL;
return GL_FALSE;
}
savageScreen->aperture.size,
(drmAddress *)&savageScreen->aperture.map) != 0)
{
- _mesa_free(savageScreen);
+ free(savageScreen);
sPriv->private = NULL;
return GL_FALSE;
}
/* free all option information */
driDestroyOptionInfo (&savageScreen->optionCache);
- _mesa_free(savageScreen);
+ free(savageScreen);
sPriv->private = NULL;
}
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;
}
shareCtx = NULL;
ctx = _mesa_create_context(mesaVis, shareCtx, &functions, imesa);
if (!ctx) {
- _mesa_free(imesa);
+ free(imesa);
return GL_FALSE;
}
driContextPriv->driverPrivate = imesa;
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;
}
_mesa_destroy_context(imesa->glCtx);
/* no longer use vertex_dma_buf*/
- _mesa_free(imesa);
+ free(imesa);
}
}
dstRow += dstRowStride;
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
return GL_TRUE;
}
dstRow += dstRowStride;
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
return GL_TRUE;
}
TRACE;
- psp = _mesa_calloc(sizeof(*psp));
+ psp = calloc(1, sizeof(*psp));
if (!psp)
return NULL;
TRACE;
if (psp) {
- _mesa_free(psp);
+ free(psp);
}
}
{
TRACE;
- _mesa_free(rb->Data);
- _mesa_free(rb);
+ free(rb->Data);
+ free(rb);
}
static GLboolean
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;
}
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;
TRACE;
- buf = _mesa_calloc(sizeof *buf);
+ buf = calloc(1, sizeof *buf);
if (!buf)
return NULL;
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);
if (buf) {
struct gl_framebuffer *fb = &buf->Base;
- _mesa_free(buf->row);
+ free(buf->row);
fb->DeletePending = GL_TRUE;
_mesa_reference_framebuffer(&fb, NULL);
TRACE;
- ctx = _mesa_calloc(sizeof *ctx);
+ ctx = calloc(1, sizeof *ctx);
if (!ctx)
return NULL;
if (!_mesa_initialize_context(&ctx->Base, &config->modes,
shared ? &shared->Base : NULL,
&functions, (void *) ctx)) {
- _mesa_free(ctx);
+ free(ctx);
return NULL;
}
}
else if (t->memType == VIA_MEM_SYSTEM) {
- t->bufAddr = _mesa_malloc(t->size);
+ t->bufAddr = malloc(t->size);
if (!t->bufAddr)
goto cleanup;
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 );
break;
default:
/* unexpected token */
- _mesa_free(vis);
+ free(vis);
return NULL;
}
}
}
else {
_mesa_problem(NULL, "Unsupported fbdev RGB visual/bitdepth!\n");
- _mesa_free(vis);
+ free(vis);
return NULL;
}
}
}
else {
_mesa_problem(NULL, "Unsupported fbdev CI visual/bitdepth!\n");
- _mesa_free(vis);
+ free(vis);
return NULL;
}
}
accumBlueBits, accumAlphaBits,
numSamples)) {
/* something was invalid */
- _mesa_free(vis);
+ free(vis);
return NULL;
}
glFBDevDestroyVisual( GLFBDevVisualPtr visual )
{
if (visual)
- _mesa_free(visual);
+ free(visual);
}
{
struct GLFBDevRenderbufferRec *frb = (struct GLFBDevRenderbufferRec *) rb;
if (frb->mallocedBuffer) {
- _mesa_free(frb->Base.Data);
+ free(frb->Base.Data);
}
- _mesa_free(frb);
+ free(frb);
}
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;
}
}
if (!_mesa_initialize_context(&ctx->glcontext, &visual->glvisual,
share ? &share->glcontext : NULL,
&functions, (void *) ctx)) {
- _mesa_free(ctx);
+ free(ctx);
return NULL;
}
_mesa_make_current(NULL, NULL, NULL);
}
_mesa_free_context_data(&context->glcontext);
- _mesa_free(context);
+ free(context);
}
}
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 */
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;
}
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");
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;
&(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 */
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);
!_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;
static void
osmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
{
- _mesa_free(rb);
+ free(rb);
}
1 /* num samples */
);
if (!osmesa->gl_visual) {
- _mesa_free(osmesa);
+ free(osmesa);
return NULL;
}
: (GLcontext *) NULL,
&functions, (void *) osmesa)) {
_mesa_destroy_visual( osmesa->gl_visual );
- _mesa_free(osmesa);
+ free(osmesa);
return NULL;
}
if (!osmesa->gl_buffer) {
_mesa_destroy_visual( osmesa->gl_visual );
_mesa_free_context_data( &osmesa->mesa );
- _mesa_free(osmesa);
+ free(osmesa);
return NULL;
}
!_swsetup_CreateContext( ctx )) {
_mesa_destroy_visual(osmesa->gl_visual);
_mesa_free_context_data(ctx);
- _mesa_free(osmesa);
+ free(osmesa);
return NULL;
}
_mesa_reference_framebuffer( &osmesa->gl_buffer, NULL );
_mesa_free_context_data( &osmesa->mesa );
- _mesa_free( osmesa );
+ free( osmesa );
}
}
_mesa_add_soft_renderbuffers
_mesa_add_renderbuffer
_mesa_bzero
- _mesa_calloc
_mesa_check_conditional_render
_mesa_choose_tex_format
_mesa_create_framebuffer
_mesa_error
_mesa_finish_render_texture
_mesa_framebuffer_renderbuffer
- _mesa_free
_mesa_free_context_data
_mesa_free_texture_image_data
_mesa_generate_mipmap
static void
wmesa_delete_renderbuffer(struct gl_renderbuffer *rb)
{
- _mesa_free(rb);
+ free(rb);
}
1); /* num samples */
if (!visual) {
- _mesa_free(c);
+ free(c);
return NULL;
}
!_tnl_CreateContext(ctx) ||
!_swsetup_CreateContext(ctx)) {
_mesa_free_context_data(ctx);
- _mesa_free(c);
+ free(c);
return NULL;
}
_swsetup_Wakeup(ctx);
_swrast_DestroyContext(ctx);
_mesa_free_context_data(ctx);
- _mesa_free(pwc);
+ free(pwc);
}
_mesa_buffer_data
_mesa_buffer_map
_mesa_buffer_subdata
- _mesa_bzero
- _mesa_calloc
_mesa_choose_tex_format
_mesa_compressed_texture_size
_mesa_create_framebuffer
_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
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));
}
xmvis = create_glx_visual( dpy, visinfo );
if (!xmvis) {
/* unusable visual */
- _mesa_free(glxCtx);
+ free(glxCtx);
return NULL;
}
}
glxCtx->xmesaContext = XMesaCreateContext(xmvis,
shareCtx ? shareCtx->xmesaContext : NULL);
if (!glxCtx->xmesaContext) {
- _mesa_free(glxCtx);
+ free(glxCtx);
return NULL;
}
MakeCurrent_PrevReadBuffer = 0;
XMesaDestroyContext( glxCtx->xmesaContext );
XMesaGarbageCollect();
- _mesa_free(glxCtx);
+ free(glxCtx);
}
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;
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;
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));
}
glxCtx->xmesaContext = XMesaCreateContext(xmvis,
shareCtx ? shareCtx->xmesaContext : NULL);
if (!glxCtx->xmesaContext) {
- _mesa_free(glxCtx);
+ free(glxCtx);
return NULL;
}
glxCtx->xmesaContext = XMesaCreateContext(xmvis,
shareCtx ? shareCtx->xmesaContext : NULL);
if (!glxCtx->xmesaContext) {
- _mesa_free(glxCtx);
+ free(glxCtx);
return NULL;
}
/* 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;
*/
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;
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;
|| 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);
*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
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));
void XMesaDestroyVisual( XMesaVisual v )
{
#ifndef XFree86Server
- _mesa_free(v->visinfo);
+ free(v->visinfo);
#endif
- _mesa_free(v);
+ free(v);
}
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;
}
!_tnl_CreateContext( mesaCtx ) ||
!_swsetup_CreateContext( mesaCtx )) {
_mesa_free_context_data(&c->mesa);
- _mesa_free(c);
+ free(c);
return NULL;
}
_tnl_DestroyContext( mesaCtx );
_vbo_DestroyContext( mesaCtx );
_mesa_free_context_data( mesaCtx );
- _mesa_free( c );
+ free( c );
}
* should probably get freed here, but that's currently done in
* XMesaDestroyBuffer().
*/
- _mesa_free(rb);
+ free(rb);
}
}
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);
}
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);
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);
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'
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'
(void) ctx;
unbind_array_object_vbos(ctx, obj);
_glthread_DESTROY_MUTEX(obj->Mutex);
- _mesa_free(obj);
+ free(obj);
}
}
next = attr->next;
- _mesa_free(attr->data);
- _mesa_free(attr);
+ free(attr->data);
+ free(attr);
attr = next;
}
}
(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);
}
_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");
_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;
}
}
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,
accumRedBits, accumGreenBits,
accumBlueBits, accumAlphaBits,
numSamples)) {
- _mesa_free(vis);
+ free(vis);
return NULL;
}
}
void
_mesa_destroy_visual( GLvisual *vis )
{
- _mesa_free(vis);
+ free(vis);
}
/*@}*/
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;
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
ASSERT(visual);
/*ASSERT(driverContext);*/
- ctx = (GLcontext *) _mesa_calloc(sizeof(GLcontext));
+ ctx = (GLcontext *) calloc(1, sizeof(GLcontext));
if (!ctx)
return NULL;
return ctx;
}
else {
- _mesa_free(ctx);
+ free(ctx);
return NULL;
}
}
#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 );
_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()) {
{
if (ctx) {
_mesa_free_context_data(ctx);
- _mesa_free( (void *) ctx );
+ free( (void *) ctx );
}
}
/**
* 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)
#define MAX_STRING 50
char *buffer;
- buffer = (char *) _mesa_malloc(MAX_STRING);
+ buffer = (char *) malloc(MAX_STRING);
if (!buffer)
return NULL;
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 */
ctx->Pack = store; /* restore */
- _mesa_free(buffer);
+ free(buffer);
}
}
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);
_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);
}
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);
_mesa_PopClientAttrib();
- _mesa_free(buf);
+ free(buf);
}
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);
_mesa_PopClientAttrib();
- _mesa_free(buf);
- _mesa_free(buf2);
+ free(buf);
+ free(buf2);
}
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);
_mesa_PopClientAttrib();
- _mesa_free(buf);
- _mesa_free(buf2);
+ free(buf);
+ free(buf2);
}
ASSERT(rb->Format == MESA_FORMAT_Z24_S8 ||
rb->Format == MESA_FORMAT_S8_Z24);
_mesa_reference_renderbuffer(&rb->Wrapped, NULL);
- _mesa_free(rb);
+ free(rb);
}
}
stencilRb->PutRow(ctx, stencilRb, width, 0, i, depthStencil, NULL);
}
- _mesa_free(data);
+ free(data);
}
{
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;
}
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
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:
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:
}
}
- _mesa_free(dlist);
+ free(dlist);
}
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;
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) {
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;
n[7].data = image;
}
else if (image) {
- _mesa_free(image);
+ free(image);
}
if (ctx->ExecuteFlag) {
CALL_CompressedTexImage1DARB(ctx->Exec,
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;
n[8].data = image;
}
else if (image) {
- _mesa_free(image);
+ free(image);
}
if (ctx->ExecuteFlag) {
CALL_CompressedTexImage2DARB(ctx->Exec,
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;
n[9].data = image;
}
else if (image) {
- _mesa_free(image);
+ free(image);
}
if (ctx->ExecuteFlag) {
CALL_CompressedTexImage3DARB(ctx->Exec,
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;
n[7].data = image;
}
else if (image) {
- _mesa_free(image);
+ free(image);
}
if (ctx->ExecuteFlag) {
CALL_CompressedTexSubImage1DARB(ctx->Exec, (target, level, 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;
n[9].data = image;
}
else if (image) {
- _mesa_free(image);
+ free(image);
}
if (ctx->ExecuteFlag) {
CALL_CompressedTexSubImage2DARB(ctx->Exec,
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;
n[11].data = image;
}
else if (image) {
- _mesa_free(image);
+ free(image);
}
if (ctx->ExecuteFlag) {
CALL_CompressedTexSubImage3DARB(ctx->Exec,
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;
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;
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;
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;
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;
void *
_mesa_exec_malloc(GLuint size)
{
- return _mesa_malloc( size );
+ return malloc( size );
}
void
_mesa_exec_free(void *addr)
{
- _mesa_free(addr);
+ free(addr);
}
{
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);
s[aLen + bLen] = '\0';
}
if (a)
- _mesa_free((void *) a);
+ free((void *) a);
return s;
}
extStrLen += strlen(extraExt) + 1; /* +1 for space */
/* allocate the extension string */
- s = (char *) _mesa_malloc(extStrLen);
+ s = (char *) malloc(extStrLen);
if (!s)
return NULL;
{
if (fb) {
_mesa_free_framebuffer_data(fb);
- _mesa_free(fb);
+ free(fb);
}
}
_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);
}
else {
table->Table[pos] = entry->Next;
}
- _mesa_free(entry);
+ free(entry);
_glthread_UNLOCK_MUTEX(table->Mutex);
return;
}
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;
}
| (p[3] );
p += 4;
}
- _mesa_free(ptrn);
+ free(ptrn);
}
}
/* Alloc dest storage */
bytes = ((width + 7) / 8 * height);
- buffer = (GLubyte *) _mesa_malloc( bytes );
+ buffer = (GLubyte *) malloc( bytes );
if (!buffer)
return NULL;
_mesa_image_address2d(packing, pixels, width, height,
GL_COLOR_INDEX, GL_BITMAP, row, 0);
if (!src) {
- _mesa_free(buffer);
+ free(buffer);
return NULL;
}
{
GLubyte *destBuffer
- = (GLubyte *) _mesa_malloc(bytesPerRow * height * depth);
+ = (GLubyte *) malloc(bytesPerRow * height * depth);
GLubyte *dst;
GLint img, row;
if (!destBuffer)
/** \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.
*
ASSERT( alignment > 0 );
- ptr = (uintptr_t) _mesa_malloc(bytes + alignment + sizeof(void *));
+ ptr = (uintptr_t) malloc(bytes + alignment + sizeof(void *));
if (!ptr)
return NULL;
}
/**
- * 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)
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;
#else
void **cubbyHole = (void **) ((char *) ptr - sizeof(void *));
void *realAddr = *cubbyHole;
- _mesa_free(realAddr);
+ free(realAddr);
#endif /* defined(HAVE_POSIX_MEMALIGN) */
}
_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;
}
/*@{*/
/**
- * Implemented using _mesa_malloc() and strcpy.
+ * Implemented using malloc() and strcpy.
* Note that NULL is handled accordingly.
*/
char *
{
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;
/*@{*/
/** 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)
* 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 );
/* Free lighting shininess exponentiation table */
foreach_s( s, tmps, ctx->_ShineTabList ) {
- _mesa_free( s );
+ free( s );
}
- _mesa_free( ctx->_ShineTabList );
+ free( ctx->_ShineTabList );
}
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;
}
if (!nextLevel) {
/* all done */
if (_mesa_is_format_compressed(srcImage->TexFormat)) {
- _mesa_free((void *) srcData);
- _mesa_free(dstData);
+ free((void *) srcData);
+ free(dstData);
}
return;
}
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;
}
/* 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;
/* 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;
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;
for (p = heap->next; p != heap; ) {
struct mem_block *next = p->next;
- _mesa_free(p);
+ free(p);
p = next;
}
- _mesa_free(heap);
+ free(heap);
}
static void
_mesa_delete_query(GLcontext *ctx, struct gl_query_object *q)
{
- _mesa_free(q);
+ free(q);
}
/* free old buffer storage */
if (rb->Data) {
- _mesa_free(rb->Data);
+ free(rb->Data);
rb->Data = NULL;
}
/* 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;
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);
}
_mesa_delete_renderbuffer(struct gl_renderbuffer *rb)
{
if (rb->Data) {
- _mesa_free(rb->Data);
+ free(rb->Data);
}
- _mesa_free(rb);
+ free(rb);
}
* 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;
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;
}
* 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;
}
if (newSource) {
_mesa_fprintf(stderr, "Mesa: Replacing shader %u chksum=%d with %s\n",
shaderObj, checksum, filename);
- _mesa_free(source);
+ free(source);
source = newSource;
}
}
sh->SourceChecksum = checksum; /* save original checksum */
}
- _mesa_free(offsets);
+ free(offsets);
}
_glthread_DESTROY_MUTEX(shared->Mutex);
_glthread_DESTROY_MUTEX(shared->TexMutex);
- _mesa_free(shared);
+ free(shared);
}
_mesa_delete_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj)
{
(void) ctx;
- _mesa_free(syncObj);
+ free(syncObj);
}
dst, dstRowStride);
if (tempImage)
- _mesa_free((void*) tempImage);
+ free((void*) tempImage);
return GL_TRUE;
}
dst, dstRowStride);
if (tempImage)
- _mesa_free((void*) tempImage);
+ free((void*) tempImage);
return GL_TRUE;
}
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");
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);
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 */
cleanUp:
if (newSource != NULL) {
- _mesa_free(newSource);
+ free(newSource);
}
}
}
if (tempImage)
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
return GL_TRUE;
}
}
if (tempImage)
- _mesa_free((void*) tempImage);
+ free((void*) tempImage);
return GL_TRUE;
}
}
if (tempImage)
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
return GL_TRUE;
}
}
if (tempImage)
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
return GL_TRUE;
}
ASSERT(texImage->Data == NULL);
if (texImage->ImageOffsets)
- _mesa_free(texImage->ImageOffsets);
- _mesa_free(texImage);
+ free(texImage->ImageOffsets);
+ free(texImage);
}
img->Depth = 0;
img->RowStride = 0;
if (img->ImageOffsets) {
- _mesa_free(img->ImageOffsets);
+ free(img->ImageOffsets);
img->ImageOffsets = NULL;
}
img->Width2 = 0;
* 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;
}
_glthread_DESTROY_MUTEX(texObj->Mutex);
/* free this object */
- _mesa_free(texObj);
+ free(texObj);
}
delete_texture_wrapper(struct gl_renderbuffer *rb)
{
ASSERT(rb->RefCount == 0);
- _mesa_free(rb);
+ free(rb);
}
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;
}
}
} /* loop over 3D image slices */
- _mesa_free(convImage);
+ free(convImage);
/* might need these below */
srcWidth = convWidth;
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;
*/
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;
}
}
}
- _mesa_free(tempImage);
+ free(tempImage);
tempImage = newImage;
}
#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;
}
/* If we made a temporary image for convolution, free it here */
if (freeSrcImage) {
- _mesa_free((void *) srcAddr);
+ free((void *) srcAddr);
}
if (logicalBaseFormat != textureBaseFormat) {
*/
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;
}
}
}
- _mesa_free(tempImage);
+ free(tempImage);
tempImage = newImage;
}
dstRow += dstRowStride;
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
}
return GL_TRUE;
}
dstRow += dstRowStride;
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
}
return GL_TRUE;
}
dstRow += dstRowStride;
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
}
return GL_TRUE;
}
dstRow += dstRowStride;
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
}
return GL_TRUE;
}
dstRow += dstRowStride;
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
}
return GL_TRUE;
}
dstRow += dstRowStride;
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
}
return GL_TRUE;
}
dstRow += dstRowStride;
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
}
return GL_TRUE;
}
dstRow += dstRowStride;
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
}
return GL_TRUE;
}
dstRow += dstRowStride;
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
}
return GL_TRUE;
}
dstRow += dstRowStride;
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
}
return GL_TRUE;
}
dstRow += dstRowStride;
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
}
return GL_TRUE;
}
src += srcWidth;
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
}
return GL_TRUE;
}
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;
dst += dstRowStride;
src += srcWidth * texelBytes;
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
}
return GL_TRUE;
}
dstRow += dstRowStride;
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
}
return GL_TRUE;
}
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
}
return GL_TRUE;
}
}
}
- _mesa_free((void *) tempImage);
+ free((void *) tempImage);
}
return GL_TRUE;
}
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);
}
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.
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)
}
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.
? 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)
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);
}
if (prog) {
prog->RefCount--;
if (prog->RefCount <= 0) {
- _mesa_free(prog);
+ free(prog);
}
}
}
/* 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
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));
}
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;
hash_table_dtor(struct hash_table *ht)
{
hash_table_clear(ht);
- _mesa_free(ht);
+ free(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]));
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;
_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
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;
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;
_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
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;
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);
/* 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;
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++)
items[c->hash % size] = c;
}
- _mesa_free(cache->items);
+ free(cache->items);
cache->items = items;
cache->size = size;
}
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;
}
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;
}
}
_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);
}
c->hash = hash;
- c->key = _mesa_malloc(keysize);
+ c->key = malloc(keysize);
memcpy(c->key, key, keysize);
c->program = program; /* no refcount change */
_mesa_alloc_instructions(GLuint numInst)
{
return (struct prog_instruction *)
- _mesa_calloc(numInst * sizeof(struct prog_instruction));
+ calloc(1, numInst * sizeof(struct prog_instruction));
}
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);
}
}
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++) {
}
done:
- _mesa_free(removeInst);
+ free(removeInst);
}
}
removeInst = (GLboolean *)
- _mesa_calloc(prog->NumInstructions * sizeof(GLboolean));
+ calloc(1, prog->NumInstructions * sizeof(GLboolean));
/*
* Look for sequences such as this:
/* 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);
/* 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;
}
}
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);
}
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;
}
= 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:
/**
* 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])
{
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);
}
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);
}
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;
_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);
/**
* 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'.
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;
return;
if (prog->String)
- _mesa_free(prog->String);
+ free(prog->String);
_mesa_free_instructions(prog->Instructions, prog->NumInstructions);
_mesa_free_parameter_list(prog->Attributes);
}
- _mesa_free(prog);
+ free(prog);
}
? err_str : "invalid condition code");
if (err_str != NULL) {
- _mesa_free(err_str);
+ free(err_str);
}
YYERROR;
? err_str : "invalid condition code");
if (err_str != NULL) {
- _mesa_free(err_str);
+ free(err_str);
}
YYERROR;
? err_str : "invalid storage size specifier");
if (err_str != NULL) {
- _mesa_free(err_str);
+ free(err_str);
}
YYERROR;
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;
}
*/
length = 1 + vsnprintf(NULL, 0, fmt, args);
- str = _mesa_malloc(length);
+ str = malloc(length);
if (str) {
vsnprintf(str, length, fmt, args);
}
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",
_mesa_set_program_error(state->ctx, locp->position, err_str);
if (err_str) {
- _mesa_free(err_str);
+ free(err_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;
error:
for (inst = state->inst_head; inst != NULL; inst = temp) {
temp = inst->next;
- _mesa_free(inst);
+ free(inst);
}
state->inst_head = NULL;
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;
? err_str : "invalid condition code");
if (err_str != NULL) {
- _mesa_free(err_str);
+ free(err_str);
}
YYERROR;
? err_str : "invalid condition code");
if (err_str != NULL) {
- _mesa_free(err_str);
+ free(err_str);
}
YYERROR;
? err_str : "invalid storage size specifier");
if (err_str != NULL) {
- _mesa_free(err_str);
+ free(err_str);
}
YYERROR;
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;
}
*/
length = 1 + vsnprintf(NULL, 0, fmt, args);
- str = _mesa_malloc(length);
+ str = malloc(length);
if (str) {
vsnprintf(str, length, fmt, args);
}
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",
_mesa_set_program_error(state->ctx, locp->position, err_str);
if (err_str) {
- _mesa_free(err_str);
+ free(err_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;
error:
for (inst = state->inst_head; inst != NULL; inst = temp) {
temp = inst->next;
- _mesa_free(inst);
+ free(inst);
}
state->inst_head = NULL;
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;
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;
}
}
{
_mesa_free_shader_program_data(ctx, shProg);
- _mesa_free(shProg);
+ free(shProg);
}
_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);
}
/* 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;
}
while (++i < n)
newList[j++] = shProg->Shaders[i];
- _mesa_free(shProg->Shaders);
+ free(shProg->Shaders);
shProg->Shaders = newList;
shProg->NumShaders = n - 1;
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);
}
}
- _mesa_free(newName);
+ free(newName);
}
}
/* 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;
if (!shProg->Validated) {
/* update info log */
if (shProg->InfoLog) {
- _mesa_free(shProg->InfoLog);
+ free(shProg->InfoLog);
}
shProg->InfoLog = _mesa_strdup(errMsg);
}
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++) {
}
assert(var->store->Size == size);
- _mesa_free(values);
+ free(values);
return GL_TRUE;
}
/* free codegen context */
/*
- _mesa_free(A->codegen);
+ free(A->codegen);
*/
return success;
/* free shader's prev info log */
if (shader->InfoLog) {
- _mesa_free(shader->InfoLog);
+ free(shader->InfoLog);
shader->InfoLog = NULL;
}
}
#if 0
if (var->aux) {
- _mesa_free(var->aux);
+ free(var->aux);
}
#endif
}
GLuint *subroutineLoc, i, total;
subroutineLoc
- = (GLuint *) _mesa_malloc(emitInfo->NumSubroutines * sizeof(GLuint));
+ = (GLuint *) malloc(emitInfo->NumSubroutines * sizeof(GLuint));
/* total number of instructions */
total = mainP->NumInstructions;
/* free subroutine list */
if (emitInfo->Subroutines) {
- _mesa_free(emitInfo->Subroutines);
+ free(emitInfo->Subroutines);
emitInfo->Subroutines = NULL;
}
emitInfo->NumSubroutines = 0;
}
}
- _mesa_free(subroutineLoc);
+ free(subroutineLoc);
}
if (l) {
l->Name = (char *) _slang_alloc(strlen(name) + 10);
if (!l->Name) {
- _mesa_free(l);
+ free(l);
return NULL;
}
_mesa_sprintf(l->Name, "%s_%d", name, id);
link_error(struct gl_shader_program *shProg, const char *msg)
{
if (shProg->InfoLog) {
- _mesa_free(shProg->InfoLog);
+ free(shProg->InfoLog);
}
shProg->InfoLog = _mesa_strdup(msg);
shProg->LinkStatus = GL_FALSE;
GLuint *map, i, firstVarying, newFile;
GLbitfield *inOutFlags;
- map = (GLuint *) _mesa_malloc(prog->Varying->NumParameters * sizeof(GLuint));
+ map = (GLuint *) malloc(prog->Varying->NumParameters * sizeof(GLuint));
if (!map)
return GL_FALSE;
&shProg->Varying->Parameters[j];
if (var->Size != v->Size) {
link_error(shProg, "mismatched varying variable types");
- _mesa_free(map);
+ free(map);
return GL_FALSE;
}
if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_CENTROID)) {
_mesa_snprintf(msg, sizeof(msg),
"centroid modifier mismatch for '%s'", var->Name);
link_error(shProg, msg);
- _mesa_free(map);
+ free(map);
return GL_FALSE;
}
if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_INVARIANT)) {
_mesa_snprintf(msg, sizeof(msg),
"invariant modifier mismatch for '%s'", var->Name);
link_error(shProg, msg);
- _mesa_free(map);
+ free(map);
return GL_FALSE;
}
}
if (shProg->Varying->NumParameters > ctx->Const.MaxVarying) {
link_error(shProg, "Too many varying variables");
- _mesa_free(map);
+ free(map);
return GL_FALSE;
}
}
}
- _mesa_free(map);
+ free(map);
/* these will get recomputed before linking is completed */
prog->InputsRead = 0x0;
GLuint totalLen = 0, len = 0;
GLuint i;
- shaderLengths = (GLuint *)_mesa_malloc(shProg->NumShaders * sizeof(GLuint));
+ shaderLengths = (GLuint *)malloc(shProg->NumShaders * sizeof(GLuint));
if (!shaderLengths) {
return NULL;
}
}
if (totalLen == 0) {
- _mesa_free(shaderLengths);
+ free(shaderLengths);
return NULL;
}
- source = (GLchar *) _mesa_malloc(totalLen + 1);
+ source = (GLchar *) malloc(totalLen + 1);
if (!source) {
- _mesa_free(shaderLengths);
+ free(shaderLengths);
return NULL;
}
_mesa_printf("---NEW CONCATENATED SHADER---:\n%s\n------------\n", source);
*/
- _mesa_free(shaderLengths);
+ free(shaderLengths);
remove_extra_version_directives(source);
newShader = CALLOC_STRUCT(gl_shader);
if (!newShader) {
- _mesa_free(source);
+ free(source);
return NULL;
}
slang_info_log_destruct(slang_info_log * log)
{
if (!log->dont_free_text)
- _mesa_free(log->text);
+ free(log->text);
}
static int
_mesa_realloc(log->text, old_len + 1, old_len + size);
}
else {
- log->text = (char *) (_mesa_malloc(size));
+ log->text = (char *) (malloc(size));
if (log->text != NULL)
log->text[0] = '\0';
}
slang_mempool *
_slang_new_mempool(GLuint initialSize)
{
- slang_mempool *pool = (slang_mempool *) _mesa_calloc(sizeof(slang_mempool));
+ slang_mempool *pool = (slang_mempool *) calloc(1, sizeof(slang_mempool));
if (pool) {
- pool->Data = (char *) _mesa_calloc(initialSize);
+ pool->Data = (char *) calloc(1, initialSize);
/*printf("ALLOC MEMPOOL %d at %p\n", initialSize, pool->Data);*/
if (!pool->Data) {
- _mesa_free(pool);
+ free(pool);
return NULL;
}
pool->Size = initialSize;
pool->Used, pool->Size, pool->Count, pool->Largest);
*/
total += pool->Used;
- _mesa_free(pool->Data);
- _mesa_free(pool);
+ free(pool->Data);
+ free(pool);
pool = next;
}
/*printf("TOTAL ALLOCATED: %u\n", total);*/
_slang_alloc(GLuint bytes)
{
#if USE_MALLOC_FREE
- return _mesa_calloc(bytes);
+ return calloc(1, bytes);
#else
slang_mempool *pool;
GET_CURRENT_CONTEXT(ctx);
_slang_free(void *addr)
{
#if USE_MALLOC_FREE
- _mesa_free(addr);
+ free(addr);
#else
if (addr) {
GET_CURRENT_CONTEXT(ctx);
slang_string_free (slang_string *self)
{
if (self->data != NULL)
- _mesa_free (self->data);
+ free(self->data);
}
GLvoid
for (hdr = table->hdr; hdr != NULL; hdr = next) {
next = hdr->next;
- _mesa_free(hdr);
+ free(hdr);
}
hash_table_dtor(table->ht);
PIPE_TRANSFER_READ, xpos, ypos,
width, height);
- buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf);
_mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()");
}
- _mesa_free(buf);
+ free(buf);
screen->tex_transfer_destroy(color_trans);
}
PIPE_TRANSFER_READ, xpos, ypos,
width, height);
- buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf);
_mesa_problem(NULL, "unexpected format in st_clear_accum_buffer()");
}
- _mesa_free(buf);
+ free(buf);
screen->tex_transfer_destroy(color_trans);
}
if (ST_DEBUG & DEBUG_FALLBACK)
debug_printf("%s: fallback processing\n", __FUNCTION__);
- buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3])
usage = PIPE_TRANSFER_READ_WRITE;
pipe_put_tile_rgba(color_trans, 0, 0, width, height, buf);
- _mesa_free(buf);
+ free(buf);
screen->tex_transfer_destroy(color_trans);
}
screen->tex_transfer_destroy(cache->trans);
}
pipe_texture_reference(&st->bitmap.cache->texture, NULL);
- _mesa_free(st->bitmap.cache);
+ free(st->bitmap.cache);
st->bitmap.cache = NULL;
}
}
if (st_obj->buffer)
pipe_buffer_reference(&st_obj->buffer, NULL);
- _mesa_free(st_obj);
+ free(st_obj);
}
ubyte *buffer;
int i;
- buffer = _mesa_malloc(width * height * sizeof(ubyte));
+ buffer = malloc(width * height * sizeof(ubyte));
if (!buffer) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels(stencil)");
return;
}
}
- _mesa_free(buffer);
+ free(buffer);
/* unmap the stencil buffer */
screen->transfer_unmap(screen, ptDraw);
if (type == GL_COLOR) {
/* alternate path using get/put_tile() */
- GLfloat *buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ GLfloat *buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
pipe_get_tile_rgba(ptRead, 0, 0, width, height, buf);
pipe_put_tile_rgba(ptTex, 0, 0, width, height, buf);
- _mesa_free(buf);
+ free(buf);
}
else {
/* GL_DEPTH */
- GLuint *buf = (GLuint *) _mesa_malloc(width * height * sizeof(GLuint));
+ GLuint *buf = (GLuint *) malloc(width * height * sizeof(GLuint));
pipe_get_tile_z(ptRead, 0, 0, width, height, buf);
pipe_put_tile_z(ptTex, 0, 0, width, height, buf);
- _mesa_free(buf);
+ free(buf);
}
screen->tex_transfer_destroy(ptRead);
if(strb->software) {
size_t size;
- _mesa_free(strb->data);
+ free(strb->data);
assert(strb->format != PIPE_FORMAT_NONE);
strb->stride = util_format_get_stride(strb->format, width);
size = util_format_get_2d_size(strb->format, strb->stride, height);
- strb->data = _mesa_malloc(size);
+ strb->data = malloc(size);
return strb->data != NULL;
}
ASSERT(strb);
pipe_surface_reference(&strb->surface, NULL);
pipe_texture_reference(&strb->texture, NULL);
- _mesa_free(strb->data);
- _mesa_free(strb);
+ free(strb->data);
+ free(strb);
}
default:
_mesa_problem(NULL,
"Unexpected format in st_new_renderbuffer_fb");
- _mesa_free(strb);
+ free(strb);
return NULL;
}
stq->pq = NULL;
}
- _mesa_free(stq);
+ free(stq);
}
static void
rastpos_destroy(struct draw_stage *stage)
{
- _mesa_free(stage);
+ free(stage);
}
else {
/* RGBA format */
GLfloat *tempSrc =
- (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
if (tempSrc && texDest) {
const GLint dims = 2;
}
if (tempSrc)
- _mesa_free(tempSrc);
+ free(tempSrc);
}
st_texture_image_unmap(ctx->st, stImage);
st->default_texture = NULL;
}
- _mesa_free( st );
+ free( st );
}
pipe->destroy( pipe );
- _mesa_free(ctx);
+ free(ctx);
}
/** clear-alloc a struct-sized object, with casting */
-#define ST_CALLOC_STRUCT(T) (struct T *) _mesa_calloc(sizeof(struct T))
+#define ST_CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))
extern int
/**
- * Tokens cannot be free with _mesa_free otherwise the builtin gallium
+ * Tokens cannot be free with free otherwise the builtin gallium
* malloc debugging will get confused.
*/
void
}
/* allocate the src/dst row buffers */
- srcBuffer = _mesa_malloc(pixelSize * srcWidth);
+ srcBuffer = malloc(pixelSize * srcWidth);
if (!srcBuffer) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
return;
}
- dstBuffer = _mesa_malloc(pixelSize * dstWidth);
+ dstBuffer = malloc(pixelSize * dstWidth);
if (!dstBuffer) {
- _mesa_free(srcBuffer);
+ free(srcBuffer);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
return;
}
drawRb->PutRow(ctx, drawRb, dstWidth, dstXpos, dstY, dstBuffer, NULL);
}
- _mesa_free(srcBuffer);
- _mesa_free(dstBuffer);
+ free(srcBuffer);
+ free(dstBuffer);
}
/* Allocate the src/dst row buffers.
* Keep two adjacent src rows around for bilinear sampling.
*/
- srcBuffer0 = _mesa_malloc(pixelSize * srcWidth);
+ srcBuffer0 = malloc(pixelSize * srcWidth);
if (!srcBuffer0) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
return;
}
- srcBuffer1 = _mesa_malloc(pixelSize * srcWidth);
+ srcBuffer1 = malloc(pixelSize * srcWidth);
if (!srcBuffer1) {
- _mesa_free(srcBuffer0);
+ free(srcBuffer0);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
return;
}
- dstBuffer = _mesa_malloc(pixelSize * dstWidth);
+ dstBuffer = malloc(pixelSize * dstWidth);
if (!dstBuffer) {
- _mesa_free(srcBuffer0);
- _mesa_free(srcBuffer1);
+ free(srcBuffer0);
+ free(srcBuffer1);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
return;
}
drawRb->PutRow(ctx, drawRb, dstWidth, dstXpos, dstY, dstBuffer, NULL);
}
- _mesa_free(srcBuffer0);
- _mesa_free(srcBuffer1);
- _mesa_free(dstBuffer);
+ free(srcBuffer0);
+ free(srcBuffer1);
+ free(dstBuffer);
}
}
/* allocate the row buffer */
- rowBuffer = _mesa_malloc(bytesPerRow);
+ rowBuffer = malloc(bytesPerRow);
if (!rowBuffer) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT");
return;
dstY += yStep;
}
- _mesa_free(rowBuffer);
+ free(rowBuffer);
}
span.arrayAttribs = FRAG_BIT_COL0;
/* allocate space for GLfloat image */
- tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ tmpImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
if (!tmpImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels");
return;
}
- convImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ convImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
if (!convImage) {
- _mesa_free(tmpImage);
+ free(tmpImage);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels");
return;
}
ASSERT(ctx->Pixel.Separable2DEnabled);
_mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage);
}
- _mesa_free(tmpImage);
+ free(tmpImage);
/* do remaining post-convolution image transfer ops */
for (row = 0; row < height; row++) {
span.array->ChanType = CHAN_TYPE;
}
- _mesa_free(convImage);
+ free(convImage);
}
span.arrayAttribs = FRAG_BIT_COL0; /* we'll fill in COL0 attrib values */
if (overlapping) {
- tmpImage = (GLfloat *) _mesa_malloc(width * height * sizeof(GLfloat) * 4);
+ tmpImage = (GLfloat *) malloc(width * height * sizeof(GLfloat) * 4);
if (!tmpImage) {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
return;
span.array->ChanType = CHAN_TYPE; /* restore */
if (overlapping)
- _mesa_free(tmpImage);
+ free(tmpImage);
}
if (overlapping) {
GLint ssy = sy;
- tmpImage = (GLuint *) _mesa_malloc(width * height * sizeof(GLuint));
+ tmpImage = (GLuint *) malloc(width * height * sizeof(GLuint));
if (!tmpImage) {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
return;
}
if (overlapping)
- _mesa_free(tmpImage);
+ free(tmpImage);
}
if (overlapping) {
GLint ssy = sy;
- tmpImage = (GLfloat *) _mesa_malloc(width * height * sizeof(GLfloat));
+ tmpImage = (GLfloat *) malloc(width * height * sizeof(GLfloat));
if (!tmpImage) {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
return;
}
if (overlapping)
- _mesa_free(tmpImage);
+ free(tmpImage);
}
if (overlapping) {
GLint ssy = sy;
- tmpImage = (GLstencil *) _mesa_malloc(width * height * sizeof(GLstencil));
+ tmpImage = (GLstencil *) malloc(width * height * sizeof(GLstencil));
if (!tmpImage) {
_mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyPixels" );
return;
}
if (overlapping)
- _mesa_free(tmpImage);
+ free(tmpImage);
}
if (stencilMask != 0x0) {
tempStencilImage
- = (GLstencil *) _mesa_malloc(width * height * sizeof(GLstencil));
+ = (GLstencil *) malloc(width * height * sizeof(GLstencil));
if (!tempStencilImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels");
return;
if (ctx->Depth.Mask) {
tempDepthImage
- = (GLfloat *) _mesa_malloc(width * height * sizeof(GLfloat));
+ = (GLfloat *) malloc(width * height * sizeof(GLfloat));
if (!tempDepthImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels");
- _mesa_free(tempStencilImage);
+ free(tempStencilImage);
return;
}
}
if (tempStencilImage)
- _mesa_free(tempStencilImage);
+ free(tempStencilImage);
if (tempDepthImage)
- _mesa_free(tempDepthImage);
+ free(tempDepthImage);
}
GLint row;
GLfloat *dest, *tmpImage;
- tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ tmpImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
if (!tmpImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
return;
}
- convImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ convImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
if (!convImage) {
- _mesa_free(tmpImage);
+ free(tmpImage);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glDrawPixels");
return;
}
ASSERT(ctx->Pixel.Separable2DEnabled);
_mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage);
}
- _mesa_free(tmpImage);
+ free(tmpImage);
/* continue transfer ops and draw the convolved image */
unpack = &ctx->DefaultPacking;
}
if (convImage) {
- _mesa_free(convImage);
+ free(convImage);
}
}
GLfloat *dest, *src, *tmpImage, *convImage;
GLint row;
- tmpImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ tmpImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
if (!tmpImage) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
return;
}
- convImage = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ convImage = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
if (!convImage) {
- _mesa_free(tmpImage);
+ free(tmpImage);
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glReadPixels");
return;
}
ASSERT(ctx->Pixel.Separable2DEnabled);
_mesa_convolve_sep_image(ctx, &width, &height, tmpImage, convImage);
}
- _mesa_free(tmpImage);
+ free(tmpImage);
/* finish transfer ops and pack the resulting image */
src = convImage;
transferOps & IMAGE_POST_CONVOLUTION_BITS);
src += width * 4;
}
- _mesa_free(convImage);
+ free(convImage);
}
else {
/* no convolution */
static GLubyte *get_space(GLcontext *ctx, GLuint bytes)
{
TNLcontext *tnl = TNL_CONTEXT(ctx);
- GLubyte *space = _mesa_malloc(bytes);
+ GLubyte *space = malloc(bytes);
tnl->block[tnl->nr_blocks++] = space;
return space;
TNLcontext *tnl = TNL_CONTEXT(ctx);
GLuint i;
for (i = 0; i < tnl->nr_blocks; i++)
- _mesa_free(tnl->block[i]);
+ free(tnl->block[i]);
tnl->nr_blocks = 0;
}
TNLcontext *tnl = TNL_CONTEXT(ctx);
struct normal_stage_data *store;
- stage->privatePtr = _mesa_malloc(sizeof(*store));
+ stage->privatePtr = malloc(sizeof(*store));
store = NORMAL_STAGE_DATA(stage);
if (!store)
return GL_FALSE;
struct normal_stage_data *store = NORMAL_STAGE_DATA(stage);
if (store) {
_mesa_vector4f_free( &store->normal );
- _mesa_free( store );
+ free( store );
stage->privatePtr = NULL;
}
}
{
struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb;
struct point_stage_data *store;
- stage->privatePtr = _mesa_malloc(sizeof(*store));
+ stage->privatePtr = malloc(sizeof(*store));
store = POINT_STAGE_DATA(stage);
if (!store)
return GL_FALSE;
struct point_stage_data *store = POINT_STAGE_DATA(stage);
if (store) {
_mesa_vector4f_free( &store->PointSize );
- _mesa_free( store );
+ free( store );
stage->privatePtr = NULL;
}
}
fastpath->match_strides = match_strides;
fastpath->func = vtx->emit;
fastpath->attr = (struct tnl_attr_type *)
- _mesa_malloc(vtx->attr_count * sizeof(fastpath->attr[0]));
+ malloc(vtx->attr_count * sizeof(fastpath->attr[0]));
for (i = 0; i < vtx->attr_count; i++) {
fastpath->attr[i].format = vtx->attr[i].format;
return;
}
- prim = _mesa_calloc(primcount * sizeof(*prim));
+ prim = calloc(1, primcount * sizeof(*prim));
if (prim == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glMultiDrawElements");
return;
}
}
- _mesa_free(prim);
+ free(prim);
}
/* If we can just tell the hardware or the TNL to interpret our
* indices with a different base, do so.
*/
- tmp_prims = (struct _mesa_prim *)_mesa_malloc(sizeof(*prim) * nr_prims);
+ tmp_prims = (struct _mesa_prim *)malloc(sizeof(*prim) * nr_prims);
for (i = 0; i < nr_prims; i++) {
tmp_prims[i] = prim[i];
else {
/* Otherwise the primitives need adjustment.
*/
- tmp_prims = (struct _mesa_prim *)_mesa_malloc(sizeof(*prim) * nr_prims);
+ tmp_prims = (struct _mesa_prim *)malloc(sizeof(*prim) * nr_prims);
for (i = 0; i < nr_prims; i++) {
/* If this fails, it could indicate an application error:
max_index - min_index );
if (tmp_indices)
- _mesa_free(tmp_indices);
+ free(tmp_indices);
if (tmp_prims)
- _mesa_free(tmp_prims);
+ free(tmp_prims);
}
switch (copy->ib->type) {
case GL_UNSIGNED_BYTE:
- copy->translated_elt_buf = _mesa_malloc(sizeof(GLuint) * copy->ib->count);
+ copy->translated_elt_buf = malloc(sizeof(GLuint) * copy->ib->count);
copy->srcelt = copy->translated_elt_buf;
for (i = 0; i < copy->ib->count; i++)
break;
case GL_UNSIGNED_SHORT:
- copy->translated_elt_buf = _mesa_malloc(sizeof(GLuint) * copy->ib->count);
+ copy->translated_elt_buf = malloc(sizeof(GLuint) * copy->ib->count);
copy->srcelt = copy->translated_elt_buf;
for (i = 0; i < copy->ib->count; i++)
*
* XXX: This should be a VBO!
*/
- copy->dstbuf = _mesa_malloc(copy->dstbuf_size * copy->vertex_size);
+ copy->dstbuf = malloc(copy->dstbuf_size * copy->vertex_size);
copy->dstptr = copy->dstbuf;
/* Setup new vertex arrays to point into the output buffer:
copy->ib->count * 2 + 3);
copy->dstelt_size = MIN2(copy->dstelt_size,
copy->limits->max_indices);
- copy->dstelt = _mesa_malloc(sizeof(GLuint) * copy->dstelt_size);
+ copy->dstelt = malloc(sizeof(GLuint) * copy->dstelt_size);
copy->dstelt_nr = 0;
/* Setup the new index buffer to point to the allocated element
/* Free our vertex and index buffers:
*/
- _mesa_free(copy->translated_elt_buf);
- _mesa_free(copy->dstbuf);
- _mesa_free(copy->dstelt);
+ free(copy->translated_elt_buf);
+ free(copy->dstbuf);
+ free(copy->dstelt);
/* Unmap VBO's
*/
fastpath->match_strides = match_strides;
fastpath->func = vf->emit;
fastpath->attr = (struct vf_attr_type *)
- _mesa_malloc(vf->attr_count * sizeof(fastpath->attr[0]));
+ malloc(vf->attr_count * sizeof(fastpath->attr[0]));
for (i = 0; i < vf->attr_count; i++) {
fastpath->attr[i].format = vf->attr[i].format;