mesa: s/CALLOC/calloc/
v2: replace instances in dri/common/ dirs Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
@@ -248,7 +248,7 @@ intel_allocate_image(int dri_format, void *loaderPrivate)
|
|||||||
{
|
{
|
||||||
__DRIimage *image;
|
__DRIimage *image;
|
||||||
|
|
||||||
image = CALLOC(sizeof *image);
|
image = calloc(1, sizeof *image);
|
||||||
if (image == NULL)
|
if (image == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -333,7 +333,7 @@ intel_create_image_from_renderbuffer(__DRIcontext *context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
irb = intel_renderbuffer(rb);
|
irb = intel_renderbuffer(rb);
|
||||||
image = CALLOC(sizeof *image);
|
image = calloc(1, sizeof *image);
|
||||||
if (image == NULL)
|
if (image == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -440,7 +440,7 @@ intel_dup_image(__DRIimage *orig_image, void *loaderPrivate)
|
|||||||
{
|
{
|
||||||
__DRIimage *image;
|
__DRIimage *image;
|
||||||
|
|
||||||
image = CALLOC(sizeof *image);
|
image = calloc(1, sizeof *image);
|
||||||
if (image == NULL)
|
if (image == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -1061,7 +1061,7 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate the private area */
|
/* Allocate the private area */
|
||||||
intelScreen = CALLOC(sizeof *intelScreen);
|
intelScreen = calloc(1, sizeof *intelScreen);
|
||||||
if (!intelScreen) {
|
if (!intelScreen) {
|
||||||
fprintf(stderr, "\nERROR! Allocating private area failed\n");
|
fprintf(stderr, "\nERROR! Allocating private area failed\n");
|
||||||
return false;
|
return false;
|
||||||
@@ -1143,7 +1143,7 @@ intelAllocateBuffer(__DRIscreen *screen,
|
|||||||
assert(attachment == __DRI_BUFFER_FRONT_LEFT ||
|
assert(attachment == __DRI_BUFFER_FRONT_LEFT ||
|
||||||
attachment == __DRI_BUFFER_BACK_LEFT);
|
attachment == __DRI_BUFFER_BACK_LEFT);
|
||||||
|
|
||||||
intelBuffer = CALLOC(sizeof *intelBuffer);
|
intelBuffer = calloc(1, sizeof *intelBuffer);
|
||||||
if (intelBuffer == NULL)
|
if (intelBuffer == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@@ -235,7 +235,7 @@ GLboolean r200CreateContext( gl_api api,
|
|||||||
assert(screen);
|
assert(screen);
|
||||||
|
|
||||||
/* Allocate the R200 context */
|
/* Allocate the R200 context */
|
||||||
rmesa = (r200ContextPtr) CALLOC( sizeof(*rmesa) );
|
rmesa = (r200ContextPtr) calloc(1, sizeof(*rmesa));
|
||||||
if ( !rmesa ) {
|
if ( !rmesa ) {
|
||||||
*error = __DRI_CTX_ERROR_NO_MEMORY;
|
*error = __DRI_CTX_ERROR_NO_MEMORY;
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
@@ -627,8 +627,8 @@ void r200InitState( r200ContextPtr rmesa )
|
|||||||
#define ALLOC_STATE( ATOM, CHK, SZ, NM, IDX ) \
|
#define ALLOC_STATE( ATOM, CHK, SZ, NM, IDX ) \
|
||||||
do { \
|
do { \
|
||||||
rmesa->hw.ATOM.cmd_size = SZ; \
|
rmesa->hw.ATOM.cmd_size = SZ; \
|
||||||
rmesa->hw.ATOM.cmd = (GLuint *)CALLOC(SZ * sizeof(int)); \
|
rmesa->hw.ATOM.cmd = (GLuint *) calloc(SZ, sizeof(int)); \
|
||||||
rmesa->hw.ATOM.lastcmd = (GLuint *)CALLOC(SZ * sizeof(int)); \
|
rmesa->hw.ATOM.lastcmd = (GLuint *) calloc(SZ, sizeof(int)); \
|
||||||
rmesa->hw.ATOM.name = NM; \
|
rmesa->hw.ATOM.name = NM; \
|
||||||
rmesa->hw.ATOM.idx = IDX; \
|
rmesa->hw.ATOM.idx = IDX; \
|
||||||
if (check_##CHK != check_never) { \
|
if (check_##CHK != check_never) { \
|
||||||
|
@@ -201,7 +201,7 @@ r100CreateContext( gl_api api,
|
|||||||
assert(screen);
|
assert(screen);
|
||||||
|
|
||||||
/* Allocate the Radeon context */
|
/* Allocate the Radeon context */
|
||||||
rmesa = (r100ContextPtr) CALLOC( sizeof(*rmesa) );
|
rmesa = (r100ContextPtr) calloc(1, sizeof(*rmesa));
|
||||||
if ( !rmesa ) {
|
if ( !rmesa ) {
|
||||||
*error = __DRI_CTX_ERROR_NO_MEMORY;
|
*error = __DRI_CTX_ERROR_NO_MEMORY;
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
@@ -42,7 +42,7 @@ void radeon_emit_queryobj(struct gl_context *ctx, struct radeon_state_atom *atom
|
|||||||
static inline void radeon_init_query_stateobj(radeonContextPtr radeon, int SZ)
|
static inline void radeon_init_query_stateobj(radeonContextPtr radeon, int SZ)
|
||||||
{
|
{
|
||||||
radeon->query.queryobj.cmd_size = (SZ);
|
radeon->query.queryobj.cmd_size = (SZ);
|
||||||
radeon->query.queryobj.cmd = (uint32_t*)CALLOC((SZ) * sizeof(uint32_t));
|
radeon->query.queryobj.cmd = (uint32_t*) calloc(SZ, sizeof(uint32_t));
|
||||||
radeon->query.queryobj.name = "queryobj";
|
radeon->query.queryobj.name = "queryobj";
|
||||||
radeon->query.queryobj.idx = 0;
|
radeon->query.queryobj.idx = 0;
|
||||||
radeon->query.queryobj.check = radeon_check_query_active;
|
radeon->query.queryobj.check = radeon_check_query_active;
|
||||||
|
@@ -212,7 +212,7 @@ radeon_create_image_from_name(__DRIscreen *screen,
|
|||||||
if (name == 0)
|
if (name == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
image = CALLOC(sizeof *image);
|
image = calloc(1, sizeof *image);
|
||||||
if (image == NULL)
|
if (image == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ radeon_create_image_from_renderbuffer(__DRIcontext *context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
rrb = radeon_renderbuffer(rb);
|
rrb = radeon_renderbuffer(rb);
|
||||||
image = CALLOC(sizeof *image);
|
image = calloc(1, sizeof *image);
|
||||||
if (image == NULL)
|
if (image == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -310,7 +310,7 @@ radeon_create_image(__DRIscreen *screen,
|
|||||||
__DRIimage *image;
|
__DRIimage *image;
|
||||||
radeonScreenPtr radeonScreen = screen->driverPrivate;
|
radeonScreenPtr radeonScreen = screen->driverPrivate;
|
||||||
|
|
||||||
image = CALLOC(sizeof *image);
|
image = calloc(1, sizeof *image);
|
||||||
if (image == NULL)
|
if (image == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -488,7 +488,7 @@ radeonCreateScreen2(__DRIscreen *sPriv)
|
|||||||
uint32_t device_id = 0;
|
uint32_t device_id = 0;
|
||||||
|
|
||||||
/* Allocate the private area */
|
/* Allocate the private area */
|
||||||
screen = (radeonScreenPtr) CALLOC( sizeof(*screen) );
|
screen = (radeonScreenPtr) calloc(1, sizeof(*screen));
|
||||||
if ( !screen ) {
|
if ( !screen ) {
|
||||||
fprintf(stderr, "%s: Could not allocate memory for screen structure", __FUNCTION__);
|
fprintf(stderr, "%s: Could not allocate memory for screen structure", __FUNCTION__);
|
||||||
fprintf(stderr, "leaving here\n");
|
fprintf(stderr, "leaving here\n");
|
||||||
|
@@ -514,8 +514,8 @@ void radeonInitState( r100ContextPtr rmesa )
|
|||||||
#define ALLOC_STATE_IDX( ATOM, CHK, SZ, NM, FLAG, IDX ) \
|
#define ALLOC_STATE_IDX( ATOM, CHK, SZ, NM, FLAG, IDX ) \
|
||||||
do { \
|
do { \
|
||||||
rmesa->hw.ATOM.cmd_size = SZ; \
|
rmesa->hw.ATOM.cmd_size = SZ; \
|
||||||
rmesa->hw.ATOM.cmd = (GLuint *)CALLOC(SZ * sizeof(int)); \
|
rmesa->hw.ATOM.cmd = (GLuint *) calloc(SZ, sizeof(int)); \
|
||||||
rmesa->hw.ATOM.lastcmd = (GLuint *)CALLOC(SZ * sizeof(int)); \
|
rmesa->hw.ATOM.lastcmd = (GLuint *) calloc(SZ, sizeof(int)); \
|
||||||
rmesa->hw.ATOM.name = NM; \
|
rmesa->hw.ATOM.name = NM; \
|
||||||
rmesa->hw.ATOM.is_tcl = FLAG; \
|
rmesa->hw.ATOM.is_tcl = FLAG; \
|
||||||
rmesa->hw.ATOM.check = check_##CHK; \
|
rmesa->hw.ATOM.check = check_##CHK; \
|
||||||
|
@@ -87,7 +87,7 @@ void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride,
|
|||||||
*/
|
*/
|
||||||
struct gl_texture_image *radeonNewTextureImage(struct gl_context *ctx)
|
struct gl_texture_image *radeonNewTextureImage(struct gl_context *ctx)
|
||||||
{
|
{
|
||||||
return CALLOC(sizeof(radeon_texture_image));
|
return calloc(1, sizeof(radeon_texture_image));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1426,7 +1426,7 @@ GLboolean _ae_create_context( struct gl_context *ctx )
|
|||||||
FogCoordFuncs[6] = _gloffset_FogCoordfvEXT;
|
FogCoordFuncs[6] = _gloffset_FogCoordfvEXT;
|
||||||
FogCoordFuncs[7] = _gloffset_FogCoorddvEXT;
|
FogCoordFuncs[7] = _gloffset_FogCoorddvEXT;
|
||||||
|
|
||||||
ctx->aelt_context = CALLOC( sizeof(AEcontext) );
|
ctx->aelt_context = calloc(1, sizeof(AEcontext));
|
||||||
if (!ctx->aelt_context)
|
if (!ctx->aelt_context)
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
|
||||||
|
@@ -671,7 +671,7 @@ init_matrix_stack( struct gl_matrix_stack *stack,
|
|||||||
stack->MaxDepth = maxDepth;
|
stack->MaxDepth = maxDepth;
|
||||||
stack->DirtyFlag = dirtyFlag;
|
stack->DirtyFlag = dirtyFlag;
|
||||||
/* The stack */
|
/* The stack */
|
||||||
stack->Stack = (GLmatrix *) CALLOC(maxDepth * sizeof(GLmatrix));
|
stack->Stack = (GLmatrix *) calloc(maxDepth, sizeof(GLmatrix));
|
||||||
for (i = 0; i < maxDepth; i++) {
|
for (i = 0; i < maxDepth; i++) {
|
||||||
_math_matrix_ctr(&stack->Stack[i]);
|
_math_matrix_ctr(&stack->Stack[i]);
|
||||||
}
|
}
|
||||||
|
@@ -4680,7 +4680,8 @@ st_translate_program(
|
|||||||
* so we put all the translated regs in t->constants.
|
* so we put all the translated regs in t->constants.
|
||||||
*/
|
*/
|
||||||
if (proginfo->Parameters) {
|
if (proginfo->Parameters) {
|
||||||
t->constants = (struct ureg_src *)CALLOC(proginfo->Parameters->NumParameters * sizeof(t->constants[0]));
|
t->constants = (struct ureg_src *)
|
||||||
|
calloc(proginfo->Parameters->NumParameters, sizeof(t->constants[0]));
|
||||||
if (t->constants == NULL) {
|
if (t->constants == NULL) {
|
||||||
ret = PIPE_ERROR_OUT_OF_MEMORY;
|
ret = PIPE_ERROR_OUT_OF_MEMORY;
|
||||||
goto out;
|
goto out;
|
||||||
@@ -4719,7 +4720,8 @@ st_translate_program(
|
|||||||
|
|
||||||
/* Emit immediate values.
|
/* Emit immediate values.
|
||||||
*/
|
*/
|
||||||
t->immediates = (struct ureg_src *)CALLOC(program->num_immediates * sizeof(struct ureg_src));
|
t->immediates = (struct ureg_src *)
|
||||||
|
calloc(program->num_immediates, sizeof(struct ureg_src));
|
||||||
if (t->immediates == NULL) {
|
if (t->immediates == NULL) {
|
||||||
ret = PIPE_ERROR_OUT_OF_MEMORY;
|
ret = PIPE_ERROR_OUT_OF_MEMORY;
|
||||||
goto out;
|
goto out;
|
||||||
|
@@ -720,7 +720,7 @@ GLboolean
|
|||||||
_swrast_CreateContext( struct gl_context *ctx )
|
_swrast_CreateContext( struct gl_context *ctx )
|
||||||
{
|
{
|
||||||
GLuint i;
|
GLuint i;
|
||||||
SWcontext *swrast = (SWcontext *)CALLOC(sizeof(SWcontext));
|
SWcontext *swrast = (SWcontext *) calloc(1, sizeof(SWcontext));
|
||||||
#ifdef _OPENMP
|
#ifdef _OPENMP
|
||||||
const GLuint maxThreads = omp_get_max_threads();
|
const GLuint maxThreads = omp_get_max_threads();
|
||||||
#else
|
#else
|
||||||
|
@@ -143,7 +143,7 @@ zoom_span( struct gl_context *ctx, GLint imgX, GLint imgY, const SWspan *span,
|
|||||||
|
|
||||||
if (!swrast->ZoomedArrays) {
|
if (!swrast->ZoomedArrays) {
|
||||||
/* allocate on demand */
|
/* allocate on demand */
|
||||||
swrast->ZoomedArrays = (SWspanarrays *) CALLOC(sizeof(SWspanarrays));
|
swrast->ZoomedArrays = (SWspanarrays *) calloc(1, sizeof(SWspanarrays));
|
||||||
if (!swrast->ZoomedArrays)
|
if (!swrast->ZoomedArrays)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,7 @@
|
|||||||
GLboolean
|
GLboolean
|
||||||
_swsetup_CreateContext( struct gl_context *ctx )
|
_swsetup_CreateContext( struct gl_context *ctx )
|
||||||
{
|
{
|
||||||
SScontext *swsetup = (SScontext *)CALLOC(sizeof(SScontext));
|
SScontext *swsetup = (SScontext *) calloc(1, sizeof(SScontext));
|
||||||
|
|
||||||
if (!swsetup)
|
if (!swsetup)
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
@@ -50,7 +50,7 @@ _tnl_CreateContext( struct gl_context *ctx )
|
|||||||
|
|
||||||
/* Create the TNLcontext structure
|
/* Create the TNLcontext structure
|
||||||
*/
|
*/
|
||||||
ctx->swtnl_context = tnl = (TNLcontext *) CALLOC( sizeof(TNLcontext) );
|
ctx->swtnl_context = tnl = (TNLcontext *) calloc(1, sizeof(TNLcontext));
|
||||||
|
|
||||||
if (!tnl) {
|
if (!tnl) {
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
@@ -514,7 +514,7 @@ init_vp(struct gl_context *ctx, struct tnl_pipeline_stage *stage)
|
|||||||
struct vp_stage_data *store;
|
struct vp_stage_data *store;
|
||||||
const GLuint size = VB->Size;
|
const GLuint size = VB->Size;
|
||||||
|
|
||||||
stage->privatePtr = CALLOC(sizeof(*store));
|
stage->privatePtr = calloc(1, sizeof(*store));
|
||||||
store = VP_STAGE_DATA(stage);
|
store = VP_STAGE_DATA(stage);
|
||||||
if (!store)
|
if (!store)
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
@@ -562,7 +562,7 @@ static GLboolean alloc_texgen_data( struct gl_context *ctx,
|
|||||||
struct texgen_stage_data *store;
|
struct texgen_stage_data *store;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
||||||
stage->privatePtr = CALLOC(sizeof(*store));
|
stage->privatePtr = calloc(1, sizeof(*store));
|
||||||
store = TEXGEN_STAGE_DATA(stage);
|
store = TEXGEN_STAGE_DATA(stage);
|
||||||
if (!store)
|
if (!store)
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
@@ -89,7 +89,7 @@ static GLboolean alloc_texmat_data( struct gl_context *ctx,
|
|||||||
struct texmat_stage_data *store;
|
struct texmat_stage_data *store;
|
||||||
GLuint i;
|
GLuint i;
|
||||||
|
|
||||||
stage->privatePtr = CALLOC(sizeof(*store));
|
stage->privatePtr = calloc(1, sizeof(*store));
|
||||||
store = TEXMAT_STAGE_DATA(stage);
|
store = TEXMAT_STAGE_DATA(stage);
|
||||||
if (!store)
|
if (!store)
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
@@ -236,7 +236,7 @@ static GLboolean init_vertex_stage( struct gl_context *ctx,
|
|||||||
struct vertex_stage_data *store;
|
struct vertex_stage_data *store;
|
||||||
GLuint size = VB->Size;
|
GLuint size = VB->Size;
|
||||||
|
|
||||||
stage->privatePtr = CALLOC(sizeof(*store));
|
stage->privatePtr = calloc(1, sizeof(*store));
|
||||||
store = VERTEX_STAGE_DATA(stage);
|
store = VERTEX_STAGE_DATA(stage);
|
||||||
if (!store)
|
if (!store)
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
|
Reference in New Issue
Block a user