Skip to content

Commit

Permalink
- fix Windows build: use malloc/free instead of stack allocation for …
Browse files Browse the repository at this point in the history
…buffer and put the buffer definition at the beginning of the block (ansi-c)

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@18144 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Nov 14, 2013
1 parent 5e12b42 commit 8c322d6
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions SimulationRuntime/c/math-support/ddassl.c
Expand Up @@ -3751,10 +3751,11 @@ doublereal ddanrm_(integer *neq, doublereal *v, doublereal *wt, doublereal *
/* WBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWB */
if(ipar[1])
{
char *buffer = NULL;
nrow = npdm1;
i__1 = *neq;
i__2 = *neq;
char buffer[20*nrow];
buffer = (char*)malloc(20*nrow*sizeof(char));

INFO1(LOG_JAC, "at point in time: %g", *x);
INDENT(LOG_JAC);
Expand All @@ -3764,7 +3765,7 @@ doublereal ddanrm_(integer *neq, doublereal *v, doublereal *wt, doublereal *
INDENT(LOG_JAC);
for(k=0;k<*neq;k++)
{
INFO2(LOG_JAC, "[%d] %g", k+1, y[k+1]);
INFO2(LOG_JAC, "[%ld] %g", k+1, y[k+1]);
}
RELEASE(LOG_JAC);

Expand All @@ -3773,7 +3774,7 @@ doublereal ddanrm_(integer *neq, doublereal *v, doublereal *wt, doublereal *
for(i__ = 1; i__ <= i__1; ++i__)
{
wm[nrow+i__] += *cj;
sprintf(buffer, "");
sprintf(buffer, "%c", '\0');
for(l = 1; l <= i__2; ++l)
{
sprintf(buffer, "%s%g ", buffer, wm[nrow + l]);
Expand All @@ -3784,6 +3785,7 @@ doublereal ddanrm_(integer *neq, doublereal *v, doublereal *wt, doublereal *
}
RELEASE(LOG_JAC);
RELEASE(LOG_JAC);
free(buffer);
}
/* WBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWB */

Expand Down Expand Up @@ -3829,10 +3831,11 @@ doublereal ddanrm_(integer *neq, doublereal *v, doublereal *wt, doublereal *
/* WBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWB */
if(ipar[1])
{
char *buffer = NULL;
nrow = npdm1;
i__1 = *neq;
i__2 = *neq;
char buffer[20*nrow];
buffer = (char*)malloc(20*nrow*sizeof(char));

INFO1(LOG_JAC, "at point in time: %g", *x);
INDENT(LOG_JAC);
Expand All @@ -3842,7 +3845,7 @@ doublereal ddanrm_(integer *neq, doublereal *v, doublereal *wt, doublereal *
INDENT(LOG_JAC);
for(k=0;k<*neq;k++)
{
INFO2(LOG_JAC, "[%d] %g", k+1, y[k+1]);
INFO2(LOG_JAC, "[%ld] %g", k+1, y[k+1]);
}
RELEASE(LOG_JAC);

Expand All @@ -3851,7 +3854,7 @@ doublereal ddanrm_(integer *neq, doublereal *v, doublereal *wt, doublereal *
for(i__ = 1; i__ <= i__1; ++i__)
{
wm[nrow+i__] += *cj;
sprintf(buffer, "");
sprintf(buffer, "%c", '\0');
for(l = 1; l <= i__2; ++l)
{
sprintf(buffer, "%s%g ", buffer, wm[nrow + l]);
Expand All @@ -3862,6 +3865,7 @@ doublereal ddanrm_(integer *neq, doublereal *v, doublereal *wt, doublereal *
}
RELEASE(LOG_JAC);
RELEASE(LOG_JAC);
free(buffer);
}
/* WBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWBWB */

Expand Down

0 comments on commit 8c322d6

Please sign in to comment.