Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 9cbbca6

Browse files
rfrankeOpenModelica-Hudson
authored andcommitted
Remove special treatment of string return args, ticket:3446
The removed code assigned an uninitialized temporary strVar to the output of the function. It does not appear needed because std::string can be assigned like any other variable.
1 parent dba9dd8 commit 9cbbca6

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

Compiler/Template/CodegenCpp.tpl

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5289,23 +5289,6 @@ case FUNCTION(__)
52895289
case EXTERNAL_FUNCTION(__) then
52905290
let fname = underscorePath(name)
52915291
match var
5292-
/* The storage size of arrays is known at call time, so they can be allocated
5293-
* before set_memory_state. Strings are not known, so we copy them, etc...
5294-
*/
5295-
case var as VARIABLE(ty = T_STRING(__)) then
5296-
if not acceptMetaModelicaGrammar() then
5297-
// We need to strdup() all strings, then allocate them on the memory pool again, then free the temporary string
5298-
let strVar = tempDecl("string", &varDecls)
5299-
5300-
let &varAssign +=
5301-
<<
5302-
//_<%fname%> = <%strVar%>;
5303-
output = <%strVar%>;
5304-
>>
5305-
""
5306-
else
5307-
let &varAssign += /*_<%fname%> */'output = <%contextCref(var.name,contextFunction,simCode , &extraFuncs , &extraFuncsDecl, extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)%>;<%\n%>'
5308-
""
53095292
case var as VARIABLE(__) then
53105293
let marker = '<%contextCref(var.name,contextFunction,simCode , &extraFuncs , &extraFuncsDecl, extraFuncsNamespace, stateDerVectorName, useFlatArrayNotation)%>'
53115294
let &varInits += '/* varOutput varInits(<%marker%>) */ <%\n%>'

0 commit comments

Comments
 (0)