From 32f2fd1c5d6088692551c80352b7d6fa35b0cd09 Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Fri, 19 Feb 2010 11:58:49 -0500 Subject: Replace _mesa_malloc, _mesa_calloc and _mesa_free with plain libc versions --- src/mesa/swrast/s_blit.c | 32 ++++++++++++++++---------------- src/mesa/swrast/s_copypix.c | 36 ++++++++++++++++++------------------ src/mesa/swrast/s_drawpix.c | 10 +++++----- src/mesa/swrast/s_readpix.c | 10 +++++----- 4 files changed, 44 insertions(+), 44 deletions(-) (limited to 'src/mesa/swrast') diff --git a/src/mesa/swrast/s_blit.c b/src/mesa/swrast/s_blit.c index f73ac78ae2..753f3136f5 100644 --- a/src/mesa/swrast/s_blit.c +++ b/src/mesa/swrast/s_blit.c @@ -198,14 +198,14 @@ blit_nearest(GLcontext *ctx, } /* 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; } @@ -235,8 +235,8 @@ blit_nearest(GLcontext *ctx, drawRb->PutRow(ctx, drawRb, dstWidth, dstXpos, dstY, dstBuffer, NULL); } - _mesa_free(srcBuffer); - _mesa_free(dstBuffer); + free(srcBuffer); + free(dstBuffer); } @@ -366,21 +366,21 @@ blit_linear(GLcontext *ctx, /* 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; } @@ -444,9 +444,9 @@ blit_linear(GLcontext *ctx, drawRb->PutRow(ctx, drawRb, dstWidth, dstXpos, dstY, dstBuffer, NULL); } - _mesa_free(srcBuffer0); - _mesa_free(srcBuffer1); - _mesa_free(dstBuffer); + free(srcBuffer0); + free(srcBuffer1); + free(dstBuffer); } @@ -535,7 +535,7 @@ simple_blit(GLcontext *ctx, } /* allocate the row buffer */ - rowBuffer = _mesa_malloc(bytesPerRow); + rowBuffer = malloc(bytesPerRow); if (!rowBuffer) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBlitFrameBufferEXT"); return; @@ -548,7 +548,7 @@ simple_blit(GLcontext *ctx, dstY += yStep; } - _mesa_free(rowBuffer); + free(rowBuffer); } diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index b69be50f51..3f37c027e4 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -114,14 +114,14 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, 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; } @@ -150,7 +150,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, 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++) { @@ -185,7 +185,7 @@ copy_conv_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, span.array->ChanType = CHAN_TYPE; } - _mesa_free(convImage); + free(convImage); } @@ -246,7 +246,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, 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; @@ -303,7 +303,7 @@ copy_rgba_pixels(GLcontext *ctx, GLint srcx, GLint srcy, span.array->ChanType = CHAN_TYPE; /* restore */ if (overlapping) - _mesa_free(tmpImage); + free(tmpImage); } @@ -352,7 +352,7 @@ copy_ci_pixels( GLcontext *ctx, GLint srcx, GLint srcy, 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; @@ -397,7 +397,7 @@ copy_ci_pixels( GLcontext *ctx, GLint srcx, GLint srcy, } if (overlapping) - _mesa_free(tmpImage); + free(tmpImage); } @@ -487,7 +487,7 @@ copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, 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; @@ -537,7 +537,7 @@ copy_depth_pixels( GLcontext *ctx, GLint srcx, GLint srcy, } if (overlapping) - _mesa_free(tmpImage); + free(tmpImage); } @@ -584,7 +584,7 @@ copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, 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; @@ -626,7 +626,7 @@ copy_stencil_pixels( GLcontext *ctx, GLint srcx, GLint srcy, } if (overlapping) - _mesa_free(tmpImage); + free(tmpImage); } @@ -688,7 +688,7 @@ copy_depth_stencil_pixels(GLcontext *ctx, 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; @@ -706,10 +706,10 @@ copy_depth_stencil_pixels(GLcontext *ctx, 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; } @@ -799,10 +799,10 @@ copy_depth_stencil_pixels(GLcontext *ctx, } if (tempStencilImage) - _mesa_free(tempStencilImage); + free(tempStencilImage); if (tempDepthImage) - _mesa_free(tempDepthImage); + free(tempDepthImage); } diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 136c296e98..7571d5b8c0 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -566,14 +566,14 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, 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; } @@ -597,7 +597,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, 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; @@ -677,7 +677,7 @@ draw_rgba_pixels( GLcontext *ctx, GLint x, GLint y, } if (convImage) { - _mesa_free(convImage); + free(convImage); } } diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index 94fb974eab..41911337b8 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -358,14 +358,14 @@ read_rgba_pixels( GLcontext *ctx, 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; } @@ -399,7 +399,7 @@ read_rgba_pixels( GLcontext *ctx, 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; @@ -412,7 +412,7 @@ read_rgba_pixels( GLcontext *ctx, transferOps & IMAGE_POST_CONVOLUTION_BITS); src += width * 4; } - _mesa_free(convImage); + free(convImage); } else { /* no convolution */ -- cgit v1.2.3