diff options
author | Kristian Høgsberg <[email protected]> | 2010-02-19 11:58:49 -0500 |
---|---|---|
committer | Kristian Høgsberg <[email protected]> | 2010-02-19 12:03:01 -0500 |
commit | 32f2fd1c5d6088692551c80352b7d6fa35b0cd09 (patch) | |
tree | 5c44742f6d4f8711b6d1ca31d68d3245abd0187a /src/mesa/shader | |
parent | 6bf1ea897fa470af58fe8916dff45e2da79634a3 (diff) |
Replace _mesa_malloc, _mesa_calloc and _mesa_free with plain libc versions
Diffstat (limited to 'src/mesa/shader')
26 files changed, 128 insertions, 128 deletions
diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index bdd26b7f3a7..03ff30a2394 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -85,7 +85,7 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target, } if (program->Base.String != NULL) - _mesa_free(program->Base.String); + free(program->Base.String); /* Copy the relevant contents of the arb_program struct into the * fragment_program struct. @@ -130,7 +130,7 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target, program->Base.InputsRead |= FRAG_BIT_FOGC; if (program->Base.Instructions) - _mesa_free(program->Base.Instructions); + free(program->Base.Instructions); program->Base.Instructions = prog.Instructions; if (program->Base.Parameters) @@ -181,7 +181,7 @@ _mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target, } if (program->Base.String != NULL) - _mesa_free(program->Base.String); + free(program->Base.String); /* Copy the relevant contents of the arb_program struct into the * vertex_program struct. @@ -203,7 +203,7 @@ _mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target, ? GL_TRUE : GL_FALSE; if (program->Base.Instructions) - _mesa_free(program->Base.Instructions); + free(program->Base.Instructions); program->Base.Instructions = prog.Instructions; if (program->Base.Parameters) diff --git a/src/mesa/shader/atifragshader.c b/src/mesa/shader/atifragshader.c index fb2fa4b95f9..870f77e30dc 100644 --- a/src/mesa/shader/atifragshader.c +++ b/src/mesa/shader/atifragshader.c @@ -60,11 +60,11 @@ _mesa_delete_ati_fragment_shader(GLcontext *ctx, struct ati_fragment_shader *s) GLuint i; for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { if (s->Instructions[i]) - _mesa_free(s->Instructions[i]); + free(s->Instructions[i]); if (s->SetupInst[i]) - _mesa_free(s->SetupInst[i]); + free(s->SetupInst[i]); } - _mesa_free(s); + free(s); } @@ -293,7 +293,7 @@ _mesa_DeleteFragmentShaderATI(GLuint id) if (prog) { prog->RefCount--; if (prog->RefCount <= 0) { - _mesa_free(prog); + free(prog); } } } @@ -318,9 +318,9 @@ _mesa_BeginFragmentShaderATI(void) /* no idea if it's allowed to redefine a shader */ for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { if (ctx->ATIFragmentShader.Current->Instructions[i]) - _mesa_free(ctx->ATIFragmentShader.Current->Instructions[i]); + free(ctx->ATIFragmentShader.Current->Instructions[i]); if (ctx->ATIFragmentShader.Current->SetupInst[i]) - _mesa_free(ctx->ATIFragmentShader.Current->SetupInst[i]); + free(ctx->ATIFragmentShader.Current->SetupInst[i]); } /* malloc the instructions here - not sure if the best place but its @@ -328,11 +328,11 @@ _mesa_BeginFragmentShaderATI(void) for (i = 0; i < MAX_NUM_PASSES_ATI; i++) { ctx->ATIFragmentShader.Current->Instructions[i] = (struct atifs_instruction *) - _mesa_calloc(sizeof(struct atifs_instruction) * + calloc(1, sizeof(struct atifs_instruction) * (MAX_NUM_INSTRUCTIONS_PER_PASS_ATI)); ctx->ATIFragmentShader.Current->SetupInst[i] = (struct atifs_setupinst *) - _mesa_calloc(sizeof(struct atifs_setupinst) * + calloc(1, sizeof(struct atifs_setupinst) * (MAX_NUM_FRAGMENT_REGISTERS_ATI)); } diff --git a/src/mesa/shader/hash_table.c b/src/mesa/shader/hash_table.c index e89a2564d76..fa6ba2bfdfc 100644 --- a/src/mesa/shader/hash_table.c +++ b/src/mesa/shader/hash_table.c @@ -65,7 +65,7 @@ hash_table_ctor(unsigned num_buckets, hash_func_t hash, num_buckets = 16; } - ht = _mesa_malloc(sizeof(*ht) + ((num_buckets - 1) + ht = malloc(sizeof(*ht) + ((num_buckets - 1) * sizeof(ht->buckets[0]))); if (ht != NULL) { ht->hash = hash; @@ -85,7 +85,7 @@ void hash_table_dtor(struct hash_table *ht) { hash_table_clear(ht); - _mesa_free(ht); + free(ht); } @@ -100,7 +100,7 @@ hash_table_clear(struct hash_table *ht) for (i = 0; i < ht->num_buckets; i++) { foreach_s(node, temp, & ht->buckets[i]) { remove_from_list(node); - _mesa_free(node); + free(node); } assert(is_empty_list(& ht->buckets[i])); @@ -134,7 +134,7 @@ hash_table_insert(struct hash_table *ht, void *data, const void *key) const unsigned bucket = hash_value % ht->num_buckets; struct hash_node *node; - node = _mesa_calloc(sizeof(*node)); + node = calloc(1, sizeof(*node)); node->data = data; node->key = key; diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c index 639408d82a4..4f02703619c 100644 --- a/src/mesa/shader/nvfragparse.c +++ b/src/mesa/shader/nvfragparse.c @@ -171,7 +171,7 @@ record_error(struct parse_state *parseState, const char *msg, int lineNo) _mesa_debug(parseState->ctx, "nvfragparse.c(%d): line %d, column %d:%s (%s)\n", lineNo, line, column, (char *) lineStr, msg); - _mesa_free((void *) lineStr); + free((void *) lineStr); #else (void) lineNo; #endif @@ -1231,7 +1231,7 @@ Parse_PrintInstruction(struct parse_state *parseState, for (len = 0; str[len] != '\''; len++) /* find closing quote */ ; parseState->pos += len + 1; - msg = (GLubyte*) _mesa_malloc(len + 1); + msg = (GLubyte*) malloc(len + 1); memcpy(msg, str, len); msg[len] = 0; @@ -1548,7 +1548,7 @@ _mesa_parse_nv_fragment_program(GLcontext *ctx, GLenum dstTarget, program->Base.String = programString; program->Base.Format = GL_PROGRAM_FORMAT_ASCII_ARB; if (program->Base.Instructions) { - _mesa_free(program->Base.Instructions); + free(program->Base.Instructions); } program->Base.Instructions = newInst; program->Base.NumInstructions = parseState.numInst; diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c index 3656438d42c..fb36303bb97 100644 --- a/src/mesa/shader/nvvertparse.c +++ b/src/mesa/shader/nvvertparse.c @@ -82,7 +82,7 @@ record_error(struct parse_state *parseState, const char *msg, int lineNo) _mesa_debug(parseState->ctx, "nvfragparse.c(%d): line %d, column %d:%s (%s)\n", lineNo, line, column, (char *) lineStr, msg); - _mesa_free((void *) lineStr); + free((void *) lineStr); #else (void) lineNo; #endif @@ -1048,7 +1048,7 @@ Parse_PrintInstruction(struct parse_state *parseState, struct prog_instruction * for (len = 0; str[len] != '\''; len++) /* find closing quote */ ; parseState->pos += len + 1; - msg = (GLubyte*) _mesa_malloc(len + 1); + msg = (GLubyte*) malloc(len + 1); memcpy(msg, str, len); msg[len] = 0; @@ -1372,7 +1372,7 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget, newInst = _mesa_alloc_instructions(parseState.numInst); if (!newInst) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); - _mesa_free(programString); + free(programString); return; /* out of memory */ } _mesa_copy_instructions(newInst, instBuffer, parseState.numInst); @@ -1380,12 +1380,12 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget, /* install the program */ program->Base.Target = target; if (program->Base.String) { - _mesa_free(program->Base.String); + free(program->Base.String); } program->Base.String = programString; program->Base.Format = GL_PROGRAM_FORMAT_ASCII_ARB; if (program->Base.Instructions) { - _mesa_free(program->Base.Instructions); + free(program->Base.Instructions); } program->Base.Instructions = newInst; program->Base.InputsRead = parseState.inputsRead; diff --git a/src/mesa/shader/prog_cache.c b/src/mesa/shader/prog_cache.c index 8e54f3a5a03..e5b602fc093 100644 --- a/src/mesa/shader/prog_cache.c +++ b/src/mesa/shader/prog_cache.c @@ -87,7 +87,7 @@ rehash(struct gl_program_cache *cache) cache->last = NULL; size = cache->size * 3; - items = (struct cache_item**) _mesa_malloc(size * sizeof(*items)); + items = (struct cache_item**) malloc(size * sizeof(*items)); memset(items, 0, size * sizeof(*items)); for (i = 0; i < cache->size; i++) @@ -97,7 +97,7 @@ rehash(struct gl_program_cache *cache) items[c->hash % size] = c; } - _mesa_free(cache->items); + free(cache->items); cache->items = items; cache->size = size; } @@ -114,9 +114,9 @@ clear_cache(GLcontext *ctx, struct gl_program_cache *cache) for (i = 0; i < cache->size; i++) { for (c = cache->items[i]; c; c = next) { next = c->next; - _mesa_free(c->key); + free(c->key); _mesa_reference_program(ctx, &c->program, NULL); - _mesa_free(c); + free(c); } cache->items[i] = NULL; } @@ -134,9 +134,9 @@ _mesa_new_program_cache(void) if (cache) { cache->size = 17; cache->items = (struct cache_item **) - _mesa_calloc(cache->size * sizeof(struct cache_item)); + calloc(1, cache->size * sizeof(struct cache_item)); if (!cache->items) { - _mesa_free(cache); + free(cache); return NULL; } } @@ -148,8 +148,8 @@ void _mesa_delete_program_cache(GLcontext *ctx, struct gl_program_cache *cache) { clear_cache(ctx, cache); - _mesa_free(cache->items); - _mesa_free(cache); + free(cache->items); + free(cache); } @@ -188,7 +188,7 @@ _mesa_program_cache_insert(GLcontext *ctx, c->hash = hash; - c->key = _mesa_malloc(keysize); + c->key = malloc(keysize); memcpy(c->key, key, keysize); c->program = program; /* no refcount change */ diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c index 0c4da4d1079..81099cb99c5 100644 --- a/src/mesa/shader/prog_instruction.c +++ b/src/mesa/shader/prog_instruction.c @@ -70,7 +70,7 @@ struct prog_instruction * _mesa_alloc_instructions(GLuint numInst) { return (struct prog_instruction *) - _mesa_calloc(numInst * sizeof(struct prog_instruction)); + calloc(1, numInst * sizeof(struct prog_instruction)); } @@ -128,11 +128,11 @@ _mesa_free_instructions(struct prog_instruction *inst, GLuint count) GLuint i; for (i = 0; i < count; i++) { if (inst[i].Data) - _mesa_free(inst[i].Data); + free(inst[i].Data); if (inst[i].Comment) - _mesa_free((char *) inst[i].Comment); + free((char *) inst[i].Comment); } - _mesa_free(inst); + free(inst); } diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c index e1ec52254c0..09816d5044d 100644 --- a/src/mesa/shader/prog_optimize.c +++ b/src/mesa/shader/prog_optimize.c @@ -237,7 +237,7 @@ _mesa_remove_dead_code(struct gl_program *prog) } removeInst = (GLboolean *) - _mesa_calloc(prog->NumInstructions * sizeof(GLboolean)); + calloc(1, prog->NumInstructions * sizeof(GLboolean)); /* Determine which temps are read and written */ for (i = 0; i < prog->NumInstructions; i++) { @@ -347,7 +347,7 @@ _mesa_remove_dead_code(struct gl_program *prog) } done: - _mesa_free(removeInst); + free(removeInst); } @@ -538,7 +538,7 @@ _mesa_remove_extra_moves(struct gl_program *prog) } removeInst = (GLboolean *) - _mesa_calloc(prog->NumInstructions * sizeof(GLboolean)); + calloc(1, prog->NumInstructions * sizeof(GLboolean)); /* * Look for sequences such as this: @@ -621,7 +621,7 @@ _mesa_remove_extra_moves(struct gl_program *prog) /* now remove the instructions which aren't needed */ rem = remove_instructions(prog, removeInst); - _mesa_free(removeInst); + free(removeInst); if (dbg) { _mesa_printf("Optimize: End remove extra moves. %u instructions removed\n", rem); diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c index 1feb7bd71d3..25bb4f3d441 100644 --- a/src/mesa/shader/prog_parameter.c +++ b/src/mesa/shader/prog_parameter.c @@ -54,16 +54,16 @@ _mesa_new_parameter_list_sized(unsigned size) /* alloc arrays */ p->Parameters = (struct gl_program_parameter *) - _mesa_calloc(size * sizeof(struct gl_program_parameter)); + calloc(1, size * sizeof(struct gl_program_parameter)); p->ParameterValues = (GLfloat (*)[4]) _mesa_align_malloc(size * 4 *sizeof(GLfloat), 16); if ((p->Parameters == NULL) || (p->ParameterValues == NULL)) { - _mesa_free(p->Parameters); + free(p->Parameters); _mesa_align_free(p->ParameterValues); - _mesa_free(p); + free(p); p = NULL; } } @@ -81,12 +81,12 @@ _mesa_free_parameter_list(struct gl_program_parameter_list *paramList) GLuint i; for (i = 0; i < paramList->NumParameters; i++) { if (paramList->Parameters[i].Name) - _mesa_free((void *) paramList->Parameters[i].Name); + free((void *) paramList->Parameters[i].Name); } - _mesa_free(paramList->Parameters); + free(paramList->Parameters); if (paramList->ParameterValues) _mesa_align_free(paramList->ParameterValues); - _mesa_free(paramList); + free(paramList); } @@ -486,7 +486,7 @@ _mesa_add_state_reference(struct gl_program_parameter_list *paramList, paramList->StateFlags |= _mesa_program_state_flags(stateTokens); /* free name string here since we duplicated it in add_parameter() */ - _mesa_free(name); + free(name); return index; } diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index 54fd88ad4fb..b238537673e 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -309,7 +309,7 @@ reg_string(gl_register_file f, GLint index, gl_prog_print_mode mode, = prog->Parameters->Parameters + index; char *state = _mesa_program_state_string(param->StateIndexes); _mesa_sprintf(str, state); - _mesa_free(state); + free(state); } break; case PROGRAM_ADDRESS: diff --git a/src/mesa/shader/prog_statevars.c b/src/mesa/shader/prog_statevars.c index f5264fa9189..2c844490dd7 100644 --- a/src/mesa/shader/prog_statevars.c +++ b/src/mesa/shader/prog_statevars.c @@ -957,7 +957,7 @@ append_index(char *dst, GLint index) /** * Make a string from the given state vector. * For example, return "state.matrix.texture[2].inverse". - * Use _mesa_free() to deallocate the string. + * Use free() to deallocate the string. */ char * _mesa_program_state_string(const gl_state_index state[STATE_LENGTH]) diff --git a/src/mesa/shader/prog_uniform.c b/src/mesa/shader/prog_uniform.c index a831ce8cb66..c408a8492c6 100644 --- a/src/mesa/shader/prog_uniform.c +++ b/src/mesa/shader/prog_uniform.c @@ -45,10 +45,10 @@ _mesa_free_uniform_list(struct gl_uniform_list *list) { GLuint i; for (i = 0; i < list->NumUniforms; i++) { - _mesa_free((void *) list->Uniforms[i].Name); + free((void *) list->Uniforms[i].Name); } - _mesa_free(list->Uniforms); - _mesa_free(list); + free(list->Uniforms); + free(list); } diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 0c3c5ffbd5f..f4f701b5461 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -127,11 +127,11 @@ _mesa_free_program_data(GLcontext *ctx) if (ctx->ATIFragmentShader.Current) { ctx->ATIFragmentShader.Current->RefCount--; if (ctx->ATIFragmentShader.Current->RefCount <= 0) { - _mesa_free(ctx->ATIFragmentShader.Current); + free(ctx->ATIFragmentShader.Current); } } #endif - _mesa_free((void *) ctx->Program.ErrorString); + free((void *) ctx->Program.ErrorString); } @@ -162,7 +162,7 @@ _mesa_update_default_objects_program(GLcontext *ctx) if (ctx->ATIFragmentShader.Current) { ctx->ATIFragmentShader.Current->RefCount--; if (ctx->ATIFragmentShader.Current->RefCount <= 0) { - _mesa_free(ctx->ATIFragmentShader.Current); + free(ctx->ATIFragmentShader.Current); } } ctx->ATIFragmentShader.Current = (struct ati_fragment_shader *) ctx->Shared->DefaultFragmentShader; @@ -180,7 +180,7 @@ void _mesa_set_program_error(GLcontext *ctx, GLint pos, const char *string) { ctx->Program.ErrorPos = pos; - _mesa_free((void *) ctx->Program.ErrorString); + free((void *) ctx->Program.ErrorString); if (!string) string = ""; ctx->Program.ErrorString = _mesa_strdup(string); @@ -190,7 +190,7 @@ _mesa_set_program_error(GLcontext *ctx, GLint pos, const char *string) /** * Find the line number and column for 'pos' within 'string'. * Return a copy of the line which contains 'pos'. Free the line with - * _mesa_free(). + * free(). * \param string the program string * \param pos the position within the string * \param line returns the line number corresponding to 'pos'. @@ -222,7 +222,7 @@ _mesa_find_line_column(const GLubyte *string, const GLubyte *pos, while (*p != 0 && *p != '\n') p++; len = p - lineStart; - s = (GLubyte *) _mesa_malloc(len + 1); + s = (GLubyte *) malloc(len + 1); memcpy(s, lineStart, len); s[len] = 0; @@ -337,7 +337,7 @@ _mesa_delete_program(GLcontext *ctx, struct gl_program *prog) return; if (prog->String) - _mesa_free(prog->String); + free(prog->String); _mesa_free_instructions(prog->Instructions, prog->NumInstructions); @@ -351,7 +351,7 @@ _mesa_delete_program(GLcontext *ctx, struct gl_program *prog) _mesa_free_parameter_list(prog->Attributes); } - _mesa_free(prog); + free(prog); } diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index 182ef4c26d1..e5ef25ec38a 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -3140,7 +3140,7 @@ yyreduce: ? err_str : "invalid condition code"); if (err_str != NULL) { - _mesa_free(err_str); + free(err_str); } YYERROR; @@ -3166,7 +3166,7 @@ yyreduce: ? err_str : "invalid condition code"); if (err_str != NULL) { - _mesa_free(err_str); + free(err_str); } YYERROR; @@ -4547,7 +4547,7 @@ yyreduce: ? err_str : "invalid storage size specifier"); if (err_str != NULL) { - _mesa_free(err_str); + free(err_str); } YYERROR; @@ -5403,7 +5403,7 @@ int add_state_reference(struct gl_program_parameter_list *param_list, param_list->StateFlags |= _mesa_program_state_flags(tokens); /* free name string here since we duplicated it in add_parameter() */ - _mesa_free(name); + free(name); return index; } @@ -5568,7 +5568,7 @@ make_error_string(const char *fmt, ...) */ length = 1 + vsnprintf(NULL, 0, fmt, args); - str = _mesa_malloc(length); + str = malloc(length); if (str) { vsnprintf(str, length, fmt, args); } @@ -5588,7 +5588,7 @@ yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s) err_str = make_error_string("glProgramStringARB(%s)\n", s); if (err_str) { _mesa_error(state->ctx, GL_INVALID_OPERATION, err_str); - _mesa_free(err_str); + free(err_str); } err_str = make_error_string("line %u, char %u: error: %s\n", @@ -5596,7 +5596,7 @@ yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s) _mesa_set_program_error(state->ctx, locp->position, err_str); if (err_str) { - _mesa_free(err_str); + free(err_str); } } @@ -5618,7 +5618,7 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str, /* Make a copy of the program string and force it to be NUL-terminated. */ - strz = (GLubyte *) _mesa_malloc(len + 1); + strz = (GLubyte *) malloc(len + 1); if (strz == NULL) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB"); return GL_FALSE; @@ -5706,7 +5706,7 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str, error: for (inst = state->inst_head; inst != NULL; inst = temp) { temp = inst->next; - _mesa_free(inst); + free(inst); } state->inst_head = NULL; @@ -5715,8 +5715,8 @@ error: for (sym = state->sym; sym != NULL; sym = temp) { temp = sym->next; - _mesa_free((void *) sym->name); - _mesa_free(sym); + free((void *) sym->name); + free(sym); } state->sym = NULL; diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index 577bd2c38d1..299e2477e48 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -1056,7 +1056,7 @@ ccMaskRule: IDENTIFIER ? err_str : "invalid condition code"); if (err_str != NULL) { - _mesa_free(err_str); + free(err_str); } YYERROR; @@ -1079,7 +1079,7 @@ ccMaskRule2: USED_IDENTIFIER ? err_str : "invalid condition code"); if (err_str != NULL) { - _mesa_free(err_str); + free(err_str); } YYERROR; @@ -1956,7 +1956,7 @@ optVarSize: string ? err_str : "invalid storage size specifier"); if (err_str != NULL) { - _mesa_free(err_str); + free(err_str); } YYERROR; @@ -2442,7 +2442,7 @@ int add_state_reference(struct gl_program_parameter_list *param_list, param_list->StateFlags |= _mesa_program_state_flags(tokens); /* free name string here since we duplicated it in add_parameter() */ - _mesa_free(name); + free(name); return index; } @@ -2607,7 +2607,7 @@ make_error_string(const char *fmt, ...) */ length = 1 + vsnprintf(NULL, 0, fmt, args); - str = _mesa_malloc(length); + str = malloc(length); if (str) { vsnprintf(str, length, fmt, args); } @@ -2627,7 +2627,7 @@ yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s) err_str = make_error_string("glProgramStringARB(%s)\n", s); if (err_str) { _mesa_error(state->ctx, GL_INVALID_OPERATION, err_str); - _mesa_free(err_str); + free(err_str); } err_str = make_error_string("line %u, char %u: error: %s\n", @@ -2635,7 +2635,7 @@ yyerror(YYLTYPE *locp, struct asm_parser_state *state, const char *s) _mesa_set_program_error(state->ctx, locp->position, err_str); if (err_str) { - _mesa_free(err_str); + free(err_str); } } @@ -2657,7 +2657,7 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str, /* Make a copy of the program string and force it to be NUL-terminated. */ - strz = (GLubyte *) _mesa_malloc(len + 1); + strz = (GLubyte *) malloc(len + 1); if (strz == NULL) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glProgramStringARB"); return GL_FALSE; @@ -2745,7 +2745,7 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str, error: for (inst = state->inst_head; inst != NULL; inst = temp) { temp = inst->next; - _mesa_free(inst); + free(inst); } state->inst_head = NULL; @@ -2754,8 +2754,8 @@ error: for (sym = state->sym; sym != NULL; sym = temp) { temp = sym->next; - _mesa_free((void *) sym->name); - _mesa_free(sym); + free((void *) sym->name); + free(sym); } state->sym = NULL; diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 7e2a60f74b7..ad3ff26c58f 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -115,12 +115,12 @@ _mesa_free_shader_program_data(GLcontext *ctx, shProg->NumShaders = 0; if (shProg->Shaders) { - _mesa_free(shProg->Shaders); + free(shProg->Shaders); shProg->Shaders = NULL; } if (shProg->InfoLog) { - _mesa_free(shProg->InfoLog); + free(shProg->InfoLog); shProg->InfoLog = NULL; } } @@ -134,7 +134,7 @@ _mesa_free_shader_program(GLcontext *ctx, struct gl_shader_program *shProg) { _mesa_free_shader_program_data(ctx, shProg); - _mesa_free(shProg); + free(shProg); } @@ -262,11 +262,11 @@ void _mesa_free_shader(GLcontext *ctx, struct gl_shader *sh) { if (sh->Source) - _mesa_free((void *) sh->Source); + free((void *) sh->Source); if (sh->InfoLog) - _mesa_free(sh->InfoLog); + free(sh->InfoLog); _mesa_reference_program(ctx, &sh->Program, NULL); - _mesa_free(sh); + free(sh); } @@ -709,7 +709,7 @@ _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader) /* alloc new, smaller array */ newList = (struct gl_shader **) - _mesa_malloc((n - 1) * sizeof(struct gl_shader *)); + malloc((n - 1) * sizeof(struct gl_shader *)); if (!newList) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glDetachShader"); return; @@ -719,7 +719,7 @@ _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader) } while (++i < n) newList[j++] = shProg->Shaders[i]; - _mesa_free(shProg->Shaders); + free(shProg->Shaders); shProg->Shaders = newList; shProg->NumShaders = n - 1; @@ -1377,7 +1377,7 @@ _mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name) if (c) { /* truncate name at [ */ const GLint len = c - name; - GLchar *newName = _mesa_malloc(len + 1); + GLchar *newName = malloc(len + 1); if (!newName) return -1; /* out of mem */ memcpy(newName, name, len); @@ -1400,7 +1400,7 @@ _mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name) } } - _mesa_free(newName); + free(newName); } } @@ -1431,7 +1431,7 @@ _mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source) /* free old shader source string and install new one */ if (sh->Source) { - _mesa_free((void *) sh->Source); + free((void *) sh->Source); } sh->Source = source; sh->CompileStatus = GL_FALSE; @@ -2155,7 +2155,7 @@ _mesa_validate_program(GLcontext *ctx, GLuint program) if (!shProg->Validated) { /* update info log */ if (shProg->InfoLog) { - _mesa_free(shProg->InfoLog); + free(shProg->InfoLog); } shProg->InfoLog = _mesa_strdup(errMsg); } diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 2280ceb9ee8..6901b93d5de 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -3639,7 +3639,7 @@ make_constant_array(slang_assemble_ctx *A, assert(initializer->type == SLANG_OPER_CALL); assert(initializer->array_constructor); - values = (GLfloat *) _mesa_malloc(numElements * 4 * sizeof(GLfloat)); + values = (GLfloat *) malloc(numElements * 4 * sizeof(GLfloat)); /* convert constructor params into ordinary floats */ for (i = 0; i < numElements; i++) { @@ -3670,7 +3670,7 @@ make_constant_array(slang_assemble_ctx *A, } assert(var->store->Size == size); - _mesa_free(values); + free(values); return GL_TRUE; } @@ -5321,7 +5321,7 @@ _slang_codegen_function(slang_assemble_ctx * A, slang_function * fun) /* free codegen context */ /* - _mesa_free(A->codegen); + free(A->codegen); */ return success; diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index 41d51cd98a5..4280698cc94 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -2948,7 +2948,7 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader) /* free shader's prev info log */ if (shader->InfoLog) { - _mesa_free(shader->InfoLog); + free(shader->InfoLog); shader->InfoLog = NULL; } diff --git a/src/mesa/shader/slang/slang_compile_variable.c b/src/mesa/shader/slang/slang_compile_variable.c index eab912710e8..23c08a9039d 100644 --- a/src/mesa/shader/slang/slang_compile_variable.c +++ b/src/mesa/shader/slang/slang_compile_variable.c @@ -182,7 +182,7 @@ slang_variable_destruct(slang_variable * var) } #if 0 if (var->aux) { - _mesa_free(var->aux); + free(var->aux); } #endif } diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index b621e892c33..8bd699ff9dc 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -2528,7 +2528,7 @@ _slang_resolve_subroutines(slang_emit_info *emitInfo) GLuint *subroutineLoc, i, total; subroutineLoc - = (GLuint *) _mesa_malloc(emitInfo->NumSubroutines * sizeof(GLuint)); + = (GLuint *) malloc(emitInfo->NumSubroutines * sizeof(GLuint)); /* total number of instructions */ total = mainP->NumInstructions; @@ -2566,7 +2566,7 @@ _slang_resolve_subroutines(slang_emit_info *emitInfo) /* free subroutine list */ if (emitInfo->Subroutines) { - _mesa_free(emitInfo->Subroutines); + free(emitInfo->Subroutines); emitInfo->Subroutines = NULL; } emitInfo->NumSubroutines = 0; @@ -2585,7 +2585,7 @@ _slang_resolve_subroutines(slang_emit_info *emitInfo) } } - _mesa_free(subroutineLoc); + free(subroutineLoc); } diff --git a/src/mesa/shader/slang/slang_label.c b/src/mesa/shader/slang/slang_label.c index 12406213656..7e00b5787fb 100644 --- a/src/mesa/shader/slang/slang_label.c +++ b/src/mesa/shader/slang/slang_label.c @@ -34,7 +34,7 @@ _slang_label_new_unique(const char *name) if (l) { l->Name = (char *) _slang_alloc(strlen(name) + 10); if (!l->Name) { - _mesa_free(l); + free(l); return NULL; } _mesa_sprintf(l->Name, "%s_%d", name, id); diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 68129d4c5a0..89658c1a398 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -68,7 +68,7 @@ static void link_error(struct gl_shader_program *shProg, const char *msg) { if (shProg->InfoLog) { - _mesa_free(shProg->InfoLog); + free(shProg->InfoLog); } shProg->InfoLog = _mesa_strdup(msg); shProg->LinkStatus = GL_FALSE; @@ -103,7 +103,7 @@ link_varying_vars(GLcontext *ctx, GLuint *map, i, firstVarying, newFile; GLbitfield *inOutFlags; - map = (GLuint *) _mesa_malloc(prog->Varying->NumParameters * sizeof(GLuint)); + map = (GLuint *) malloc(prog->Varying->NumParameters * sizeof(GLuint)); if (!map) return GL_FALSE; @@ -134,7 +134,7 @@ link_varying_vars(GLcontext *ctx, &shProg->Varying->Parameters[j]; if (var->Size != v->Size) { link_error(shProg, "mismatched varying variable types"); - _mesa_free(map); + free(map); return GL_FALSE; } if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_CENTROID)) { @@ -142,7 +142,7 @@ link_varying_vars(GLcontext *ctx, _mesa_snprintf(msg, sizeof(msg), "centroid modifier mismatch for '%s'", var->Name); link_error(shProg, msg); - _mesa_free(map); + free(map); return GL_FALSE; } if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_INVARIANT)) { @@ -150,7 +150,7 @@ link_varying_vars(GLcontext *ctx, _mesa_snprintf(msg, sizeof(msg), "invariant modifier mismatch for '%s'", var->Name); link_error(shProg, msg); - _mesa_free(map); + free(map); return GL_FALSE; } } @@ -162,7 +162,7 @@ link_varying_vars(GLcontext *ctx, if (shProg->Varying->NumParameters > ctx->Const.MaxVarying) { link_error(shProg, "Too many varying variables"); - _mesa_free(map); + free(map); return GL_FALSE; } @@ -202,7 +202,7 @@ link_varying_vars(GLcontext *ctx, } } - _mesa_free(map); + free(map); /* these will get recomputed before linking is completed */ prog->InputsRead = 0x0; @@ -594,7 +594,7 @@ concat_shaders(struct gl_shader_program *shProg, GLenum shaderType) GLuint totalLen = 0, len = 0; GLuint i; - shaderLengths = (GLuint *)_mesa_malloc(shProg->NumShaders * sizeof(GLuint)); + shaderLengths = (GLuint *)malloc(shProg->NumShaders * sizeof(GLuint)); if (!shaderLengths) { return NULL; } @@ -611,13 +611,13 @@ concat_shaders(struct gl_shader_program *shProg, GLenum shaderType) } if (totalLen == 0) { - _mesa_free(shaderLengths); + free(shaderLengths); return NULL; } - source = (GLchar *) _mesa_malloc(totalLen + 1); + source = (GLchar *) malloc(totalLen + 1); if (!source) { - _mesa_free(shaderLengths); + free(shaderLengths); return NULL; } @@ -634,13 +634,13 @@ concat_shaders(struct gl_shader_program *shProg, GLenum shaderType) _mesa_printf("---NEW CONCATENATED SHADER---:\n%s\n------------\n", source); */ - _mesa_free(shaderLengths); + free(shaderLengths); remove_extra_version_directives(source); newShader = CALLOC_STRUCT(gl_shader); if (!newShader) { - _mesa_free(source); + free(source); return NULL; } diff --git a/src/mesa/shader/slang/slang_log.c b/src/mesa/shader/slang/slang_log.c index 4f6b8541c5a..23917fbd2cf 100644 --- a/src/mesa/shader/slang/slang_log.c +++ b/src/mesa/shader/slang/slang_log.c @@ -43,7 +43,7 @@ void slang_info_log_destruct(slang_info_log * log) { if (!log->dont_free_text) - _mesa_free(log->text); + free(log->text); } static int @@ -63,7 +63,7 @@ slang_info_log_message(slang_info_log * log, const char *prefix, _mesa_realloc(log->text, old_len + 1, old_len + size); } else { - log->text = (char *) (_mesa_malloc(size)); + log->text = (char *) (malloc(size)); if (log->text != NULL) log->text[0] = '\0'; } diff --git a/src/mesa/shader/slang/slang_mem.c b/src/mesa/shader/slang/slang_mem.c index 54f5196617f..5eaa7c44272 100644 --- a/src/mesa/shader/slang/slang_mem.c +++ b/src/mesa/shader/slang/slang_mem.c @@ -56,12 +56,12 @@ struct slang_mempool_ slang_mempool * _slang_new_mempool(GLuint initialSize) { - slang_mempool *pool = (slang_mempool *) _mesa_calloc(sizeof(slang_mempool)); + slang_mempool *pool = (slang_mempool *) calloc(1, sizeof(slang_mempool)); if (pool) { - pool->Data = (char *) _mesa_calloc(initialSize); + pool->Data = (char *) calloc(1, initialSize); /*printf("ALLOC MEMPOOL %d at %p\n", initialSize, pool->Data);*/ if (!pool->Data) { - _mesa_free(pool); + free(pool); return NULL; } pool->Size = initialSize; @@ -82,8 +82,8 @@ _slang_delete_mempool(slang_mempool *pool) pool->Used, pool->Size, pool->Count, pool->Largest); */ total += pool->Used; - _mesa_free(pool->Data); - _mesa_free(pool); + free(pool->Data); + free(pool); pool = next; } /*printf("TOTAL ALLOCATED: %u\n", total);*/ @@ -125,7 +125,7 @@ void * _slang_alloc(GLuint bytes) { #if USE_MALLOC_FREE - return _mesa_calloc(bytes); + return calloc(1, bytes); #else slang_mempool *pool; GET_CURRENT_CONTEXT(ctx); @@ -231,7 +231,7 @@ void _slang_free(void *addr) { #if USE_MALLOC_FREE - _mesa_free(addr); + free(addr); #else if (addr) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/shader/slang/slang_utility.c b/src/mesa/shader/slang/slang_utility.c index 56a33e6f6b5..dc1e196bde5 100644 --- a/src/mesa/shader/slang/slang_utility.c +++ b/src/mesa/shader/slang/slang_utility.c @@ -54,7 +54,7 @@ GLvoid slang_string_free (slang_string *self) { if (self->data != NULL) - _mesa_free (self->data); + free(self->data); } GLvoid diff --git a/src/mesa/shader/symbol_table.c b/src/mesa/shader/symbol_table.c index 1f6d9b844d6..6a5d6868974 100644 --- a/src/mesa/shader/symbol_table.c +++ b/src/mesa/shader/symbol_table.c @@ -354,7 +354,7 @@ _mesa_symbol_table_dtor(struct _mesa_symbol_table *table) for (hdr = table->hdr; hdr != NULL; hdr = next) { next = hdr->next; - _mesa_free(hdr); + free(hdr); } hash_table_dtor(table->ht); |