Skip to content

Commit

Permalink
- don't allocate memory. a minor fix.
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13397 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adeas31 committed Oct 15, 2012
1 parent 5b5c3ba commit 49a506d
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions Compiler/runtime/FMIImpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,15 @@ const char* getModelVariableBaseType(fmi1_import_variable_t* variable)
*/
char* getModelVariableName(fmi1_import_variable_t* variable)
{
const char* res = fmi1_import_get_variable_name(variable);
char* res = fmi1_import_get_variable_name(variable);
int length = strlen(res);
char* model_variable_name = malloc(length+1);
strcpy(model_variable_name, res);
charReplace(model_variable_name, length, '.', '_');
charReplace(model_variable_name, length, '[', '_');
charReplace(model_variable_name, length, ']', '_');
charReplace(model_variable_name, length, ',', '_');
charReplace(model_variable_name, length, '(', '_');
charReplace(model_variable_name, length, ')', '_');
return model_variable_name;
charReplace(res, length, '.', '_');
charReplace(res, length, '[', '_');
charReplace(res, length, ']', '_');
charReplace(res, length, ',', '_');
charReplace(res, length, '(', '_');
charReplace(res, length, ')', '_');
return res;
}

/*
Expand Down

0 comments on commit 49a506d

Please sign in to comment.