diff --git a/c_runtime/meta_modelica.c b/c_runtime/meta_modelica.c index 36233063890..6177295678c 100644 --- a/c_runtime/meta_modelica.c +++ b/c_runtime/meta_modelica.c @@ -40,7 +40,7 @@ void *mmc_alloc_bytes(unsigned nbytes) static long mmc_cur_malloc_buf_ix=0; /* Until we have GC, we simply allocate in 256MB chunks... */ const long mmc_cur_malloc_buf_sz=256*1024*1024; /* 256MB chunks */ - void *p; + void *p=0; /* fprintf(stderr, "1 mmc_alloc_bytes(%ld): %ld,%ld\n", nbytes, mmc_cur_malloc_buf, mmc_cur_malloc_buf_ix); */ if (mmc_cur_malloc_buf == NULL || nbytes>(mmc_cur_malloc_buf_sz-mmc_cur_malloc_buf_ix)) { if ( (mmc_cur_malloc_buf = malloc(mmc_cur_malloc_buf_sz)) == 0 ) { @@ -54,9 +54,9 @@ void *mmc_alloc_bytes(unsigned nbytes) p = mmc_cur_malloc_buf + mmc_cur_malloc_buf_ix; /* Force 16-byte alignment, like malloc... TODO: Check if this is needed :) */ - mmc_cur_malloc_buf_ix += nbytes; // + ((nbytes%16) ? 16-(nbytes%16): 0); + mmc_cur_malloc_buf_ix += nbytes; /* + ((nbytes%16) ? 16-(nbytes%16): 0); */ - // fprintf(stderr, "2 mmc_alloc_bytes(%ld): %ld,%ld => %ld\n", nbytes, mmc_cur_malloc_buf, mmc_cur_malloc_buf_ix, p); + /* fprintf(stderr, "2 mmc_alloc_bytes(%ld): %ld,%ld => %ld\n", nbytes, mmc_cur_malloc_buf, mmc_cur_malloc_buf_ix, p); */ return p; } diff --git a/c_runtime/meta_modelica.h b/c_runtime/meta_modelica.h index 77c204914ff..b2044492326 100644 --- a/c_runtime/meta_modelica.h +++ b/c_runtime/meta_modelica.h @@ -150,7 +150,7 @@ static void *mmc_alloc_words(unsigned nwords) #define MMC_FALSE (mmc_mk_icon(0)) #define MMC_TRUE (mmc_mk_icon(1)) -#define mmc_mk_bcon(X) (X != 0 ? MMC_TRUE : MMC_FALSE) +#define mmc_mk_bcon(X) ((X) != 0 ? MMC_TRUE : MMC_FALSE) static inline void* mmc_mk_icon(mmc_sint_t i) {