Skip to content

Commit

Permalink
- Util.arrayExpand check if expansion is needed before alloc and copy…
Browse files Browse the repository at this point in the history
… array

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@12955 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Sep 17, 2012
1 parent 0d86332 commit 894b656
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Compiler/Util/Util.mo
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,12 @@ algorithm
local
Integer len,newlen;
array<Type_a> newarr;
case (_,_,_)
equation
// do nothing if n is negative or zero
true = intLt(n,1);
then
arr;
case (_,_,_)
equation
len = arrayLength(arr);
Expand All @@ -803,6 +809,7 @@ algorithm
else
equation
print("Util.arrayExpand failed!\n");
print("OldSize: " +& intString(arrayLength(arr)) +& " additional elements: " +& intString(n) +& "\n");
then
fail();
end matchcontinue;
Expand Down

0 comments on commit 894b656

Please sign in to comment.