Use _mesa_malloc(), _mesa_free(), etc everywhere, not malloc(), free(), etc.
Still using CALLOC_STRUCT() at this point.
{
GLuint i;
- st->atoms = malloc(sizeof(atoms));
+ st->atoms = _mesa_malloc(sizeof(atoms));
st->nr_atoms = sizeof(atoms)/sizeof(*atoms);
memcpy(st->atoms, atoms, sizeof(atoms));
void st_destroy_atoms( struct st_context *st )
{
if (st->atoms) {
- free(st->atoms);
+ _mesa_free(st->atoms);
st->atoms = NULL;
}
}
while (xvp) {
next = xvp->next;
- free(xvp);
+ _mesa_free(xvp);
xvp = next;
}
}
st->passthrough_fs =
util_make_fragment_passthrough_shader(st->pipe, &shader);
#if 0 /* We actually need to keep the tokens around at this time */
- free((void *) shader.tokens);
+ _mesa_free((void *) shader.tokens);
#endif
}
color_surf = screen->get_tex_surface(screen, color_strb->texture, 0, 0, 0,
PIPE_BUFFER_USAGE_CPU_READ);
- colorBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
- accBuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
+ colorBuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
+ accBuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, colorBuf);
acc_get_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, accBuf);
acc_put_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, accBuf);
- free(colorBuf);
- free(accBuf);
+ _mesa_free(colorBuf);
+ _mesa_free(accBuf);
pipe_surface_reference(&acc_surf, NULL);
pipe_surface_reference(&color_surf, NULL);
}
color_surf = screen->get_tex_surface(screen, color_strb->texture, 0, 0, 0,
PIPE_BUFFER_USAGE_CPU_READ);
- buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
+ buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, buf);
acc_put_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, buf);
- free(buf);
+ _mesa_free(buf);
pipe_surface_reference(&acc_surf, NULL);
pipe_surface_reference(&color_surf, NULL);
}
GLfloat *abuf, *cbuf = NULL;
GLint i, ch;
- abuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
+ abuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
acc_surf = screen->get_tex_surface(screen, acc_strb->texture, 0, 0, 0,
PIPE_BUFFER_USAGE_CPU_READ);
acc_get_tile_rgba(pipe, acc_surf, xpos, ypos, width, height, abuf);
if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3]) {
- cbuf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
+ cbuf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
pipe_get_tile_rgba(color_surf, xpos, ypos, width, height, cbuf);
}
pipe_put_tile_rgba(color_surf, xpos, ypos, width, height, abuf);
- free(abuf);
+ _mesa_free(abuf);
if (cbuf)
- free(cbuf);
+ _mesa_free(cbuf);
pipe_surface_reference(&acc_surf, NULL);
pipe_surface_reference(&color_surf, NULL);
}
if (st->bitmap.cache) {
pipe_texture_release(&st->bitmap.cache->texture);
- FREE(st->bitmap.cache);
+ _mesa_free(st->bitmap.cache);
st->bitmap.cache = NULL;
}
}
if (st_obj->buffer)
pipe_buffer_reference(pipe->screen, &st_obj->buffer, NULL);
- free(st_obj);
+ _mesa_free(st_obj);
}
struct pipe_context *pipe = st->pipe;
if (st->clear.vert_shader.tokens) {
- FREE((void *) st->clear.vert_shader.tokens);
+ _mesa_free((void *) st->clear.vert_shader.tokens);
st->clear.vert_shader.tokens = NULL;
}
if (st->clear.frag_shader.tokens) {
- FREE((void *) st->clear.frag_shader.tokens);
+ _mesa_free((void *) st->clear.frag_shader.tokens);
st->clear.frag_shader.tokens = NULL;
}
ubyte *buffer;
int i;
- buffer = malloc(width * height * sizeof(ubyte));
+ buffer = _mesa_malloc(width * height * sizeof(ubyte));
if (!buffer) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyPixels(stencil)");
return;
}
}
- free(buffer);
+ _mesa_free(buffer);
/* unmap the stencil buffer */
screen->surface_unmap(screen, psDraw);
if (type == GL_COLOR) {
/* alternate path using get/put_tile() */
- GLfloat *buf = (GLfloat *) malloc(width * height * 4 * sizeof(GLfloat));
+ GLfloat *buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat));
pipe_get_tile_rgba(psRead, srcx, srcy, width, height, buf);
pipe_put_tile_rgba(psTex, 0, 0, width, height, buf);
- free(buf);
+ _mesa_free(buf);
}
else {
/* GL_DEPTH */
- GLuint *buf = (GLuint *) malloc(width * height * sizeof(GLuint));
+ GLuint *buf = (GLuint *) _mesa_malloc(width * height * sizeof(GLuint));
pipe_get_tile_z(psRead, srcx, srcy, width, height, buf);
pipe_put_tile_z(psTex, 0, 0, width, height, buf);
- free(buf);
+ _mesa_free(buf);
}
pipe_surface_reference(&psRead, NULL);
}
ASSERT(strb);
pipe_surface_reference(&strb->surface, NULL);
pipe_texture_reference(&strb->texture, NULL);
- free(strb);
+ _mesa_free(strb);
}
}
if (stvp->state.tokens) {
- FREE((void *) stvp->state.tokens);
+ _mesa_free((void *) stvp->state.tokens);
stvp->state.tokens = NULL;
}
}
}
if (stfp->state.tokens) {
- FREE((void *) stfp->state.tokens);
+ _mesa_free((void *) stfp->state.tokens);
stfp->state.tokens = NULL;
}
}
if (stfp->state.tokens) {
- FREE((void *) stfp->state.tokens);
+ _mesa_free((void *) stfp->state.tokens);
stfp->state.tokens = NULL;
}
}
if (stvp->state.tokens) {
- FREE((void *) stvp->state.tokens);
+ _mesa_free((void *) stvp->state.tokens);
stvp->state.tokens = NULL;
}
stq->pq = NULL;
}
- FREE(stq);
+ _mesa_free(stq);
}
static void
rastpos_destroy(struct draw_stage *stage)
{
- free(stage);
+ _mesa_free(stage);
}
st->default_texture = NULL;
}
- free( st );
+ _mesa_free( st );
}
pipe->destroy( pipe );
- free(ctx);
+ _mesa_free(ctx);
}
if (!stobj)
return NULL;
- vec = (unsigned *) calloc(sizeof(unsigned), (count + 31) / 32);
+ vec = (unsigned *) _mesa_calloc(sizeof(unsigned) * ((count + 31) / 32));
if (!vec)
return NULL;
static INLINE void *
mem_dup(const void *src, uint size)
{
- void *dup = MALLOC(size);
+ void *dup = _mesa_malloc(size);
if (dup)
- memcpy(dup, src, size);
+ _mesa_memcpy(dup, src, size);
return dup;
}
/* free old shader state, if any */
if (stvp->state.tokens) {
- FREE((void *) stvp->state.tokens);
+ _mesa_free((void *) stvp->state.tokens);
stvp->state.tokens = NULL;
}
if (stvp->driver_shader) {