mesa: Use realloc() instead of _mesa_realloc() and remove the latter.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Matt Turner 2014-09-21 16:32:57 -07:00
parent e5162defc8
commit 452926a5ec
7 changed files with 8 additions and 30 deletions

View file

@ -248,8 +248,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
*/
xmvis->vishandle = vinfo;
/* Allocate more space for additional visual */
VisualTable = (XMesaVisual *) _mesa_realloc( VisualTable,
sizeof(XMesaVisual) * NumVisuals,
VisualTable = (XMesaVisual *) realloc( VisualTable,
sizeof(XMesaVisual) * (NumVisuals + 1));
/* add xmvis to the list */
VisualTable[NumVisuals] = xmvis;

View file

@ -326,8 +326,7 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
*/
xmvis->vishandle = vinfo;
/* Allocate more space for additional visual */
VisualTable = (XMesaVisual *) _mesa_realloc( VisualTable,
sizeof(XMesaVisual) * NumVisuals,
VisualTable = (XMesaVisual *) realloc( VisualTable,
sizeof(XMesaVisual) * (NumVisuals + 1));
/* add xmvis to the list */
VisualTable[NumVisuals] = xmvis;

View file

@ -209,20 +209,6 @@ _mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize,
#endif
}
/** Reallocate memory */
void *
_mesa_realloc(void *oldBuffer, size_t oldSize, size_t newSize)
{
const size_t copySize = (oldSize < newSize) ? oldSize : newSize;
void *newBuffer = malloc(newSize);
if (newBuffer && oldBuffer && copySize > 0)
memcpy(newBuffer, oldBuffer, copySize);
free(oldBuffer);
return newBuffer;
}
/*@}*/

View file

@ -473,9 +473,6 @@ _mesa_exec_malloc( GLuint size );
extern void
_mesa_exec_free( void *addr );
extern void *
_mesa_realloc( void *oldBuffer, size_t oldSize, size_t newSize );
#ifndef FFS_DEFINED
#define FFS_DEFINED 1

View file

@ -272,9 +272,8 @@ attach_shader(struct gl_context *ctx, GLuint program, GLuint shader)
/* grow list */
shProg->Shaders = (struct gl_shader **)
_mesa_realloc(shProg->Shaders,
n * sizeof(struct gl_shader *),
(n + 1) * sizeof(struct gl_shader *));
realloc(shProg->Shaders,
(n + 1) * sizeof(struct gl_shader *));
if (!shProg->Shaders) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glAttachShader");
return;

View file

@ -90,9 +90,8 @@ _mesa_realloc_instructions(struct prog_instruction *oldInst,
struct prog_instruction *newInst;
newInst = (struct prog_instruction *)
_mesa_realloc(oldInst,
numOldInst * sizeof(struct prog_instruction),
numNewInst * sizeof(struct prog_instruction));
realloc(oldInst,
numNewInst * sizeof(struct prog_instruction));
return newInst;
}

View file

@ -121,9 +121,8 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList,
/* realloc arrays */
paramList->Parameters = (struct gl_program_parameter *)
_mesa_realloc(paramList->Parameters,
oldNum * sizeof(struct gl_program_parameter),
paramList->Size * sizeof(struct gl_program_parameter));
realloc(paramList->Parameters,
paramList->Size * sizeof(struct gl_program_parameter));
paramList->ParameterValues = (gl_constant_value (*)[4])
_mesa_align_realloc(paramList->ParameterValues, /* old buf */