From ee295fccdd0c94cb6b8af4dfb30283e39f548223 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 29 Oct 2007 16:20:45 +0000 Subject: Make gallium compile in win32. Use FREE, MALLOC, CALLOC, GETENV wrappers. Silence compiler warnings. Add proper copyrights. --- src/mesa/pipe/tgsi/exec/tgsi_exec.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'src/mesa/pipe/tgsi/exec/tgsi_exec.c') diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/mesa/pipe/tgsi/exec/tgsi_exec.c index e4f23d3eef..7607ded63a 100644 --- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c +++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.c @@ -133,10 +133,10 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach ) labels->count = 0; declarations = (struct tgsi_full_declaration *) - malloc(maxDeclarations * sizeof(struct tgsi_full_declaration)); + MALLOC( maxDeclarations * sizeof(struct tgsi_full_declaration) ); instructions = (struct tgsi_full_instruction *) - malloc(maxInstructions * sizeof(struct tgsi_full_instruction)); + MALLOC( maxInstructions * sizeof(struct tgsi_full_instruction) ); k = tgsi_parse_init( &parse, mach->Tokens ); if (k != TGSI_PARSE_OK) { @@ -153,10 +153,12 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach ) case TGSI_TOKEN_TYPE_DECLARATION: /* save expanded declaration */ if (numDeclarations == maxDeclarations) { - maxDeclarations += 10; - declarations = realloc(declarations, + declarations = REALLOC(declarations, maxDeclarations + * sizeof(struct tgsi_full_instruction), + (maxDeclarations + 10) * sizeof(struct tgsi_full_instruction)); + maxDeclarations += 10; } memcpy(declarations + numDeclarations, &parse.FullToken.FullInstruction, @@ -186,10 +188,12 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach ) /* save expanded instruction */ if (numInstructions == maxInstructions) { - maxInstructions += 10; - instructions = realloc(instructions, + instructions = REALLOC(instructions, maxInstructions + * sizeof(struct tgsi_full_instruction), + (maxInstructions + 10) * sizeof(struct tgsi_full_instruction)); + maxInstructions += 10; } memcpy(instructions + numInstructions, &parse.FullToken.FullInstruction, @@ -204,13 +208,13 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach ) tgsi_parse_free (&parse); if (mach->Declarations) { - free(mach->Declarations); + FREE( mach->Declarations ); } mach->Declarations = declarations; mach->NumDeclarations = numDeclarations; if (mach->Instructions) { - free(mach->Instructions); + FREE( mach->Instructions ); } mach->Instructions = instructions; mach->NumInstructions = numInstructions; @@ -242,7 +246,7 @@ tgsi_exec_machine_init( k = tgsi_parse_init (&parse, mach->Tokens); if (k != TGSI_PARSE_OK) { - printf("Problem parsing!\n"); + fprintf( stderr, "Problem parsing!\n" ); return; } -- cgit v1.2.3