diff --git a/moo/lib/bigint.c b/moo/lib/bigint.c index 3c99f66..a4cb033 100644 --- a/moo/lib/bigint.c +++ b/moo/lib/bigint.c @@ -1351,7 +1351,7 @@ static MOO_INLINE moo_oow_t multiply_unsigned_array_karatsuba (moo_t* moo, const tmplen[0] = ndigits_xh + ndigits_yh; tmplen[1] = ndigits_yl + ndigits_yh + 1; if (tmplen[1] < tmplen[0]) tmplen[1] = tmplen[0]; - tmp[1] = (moo_liw_t*)moo_callocmem(moo, MOO_SIZEOF(moo_liw_t) * tmplen[1]); /* TODO: should i use the object memory? */ + tmp[1] = (moo_liw_t*)moo_callocmem(moo, MOO_SIZEOF(moo_liw_t) * tmplen[1]); /* TODO: should i use the object memory? if not, reuse the buffer and minimize memory allocation */ if (!tmp[1]) goto oops; /* make a temporary for (a0 + a1) and (a0 * b0) */ @@ -4433,7 +4433,7 @@ static moo_oow_t oow_to_text (moo_t* moo, moo_oow_t w, int flagged_radix, moo_oo const char* _digitc; int radix; - radix = flagged_radix & 0xFF; + radix = flagged_radix & MOO_INTTOSTR_RADIXMASK; _digitc = _digitc_array[!!(flagged_radix & MOO_INTTOSTR_LOWERCASE)]; MOO_ASSERT (moo, radix >= 2 && radix <= 36); @@ -4755,7 +4755,7 @@ moo_oop_t moo_inttostr (moo_t* moo, moo_oop_t num, int flagged_radix) int radix; const char* _digitc; - radix = flagged_radix & 0xFF; + radix = flagged_radix & MOO_INTTOSTR_RADIXMASK; _digitc = _digitc_array[!!(flagged_radix & MOO_INTTOSTR_LOWERCASE)]; MOO_ASSERT (moo, radix >= 2 && radix <= 36); diff --git a/moo/lib/fmtout.c b/moo/lib/fmtout.c index 39a2562..554d16d 100644 --- a/moo/lib/fmtout.c +++ b/moo/lib/fmtout.c @@ -920,7 +920,7 @@ static MOO_INLINE int print_formatted (moo_t* moo, moo_ooi_t nargs, moo_fmtout_d if (ignore_rcv) { - arg = MOO_STACK_GETARG(moo, nargs, 0); + arg = MOO_STACK_GETARG(moo, nargs, 0); arg_state.idx = 1; } else diff --git a/moo/lib/std.c b/moo/lib/std.c index c3a616a..22e67fa 100644 --- a/moo/lib/std.c +++ b/moo/lib/std.c @@ -825,7 +825,6 @@ static int write_log (moo_t* moo, int fd, const moo_bch_t* ptr, moo_oow_t len) xtn->log.out.len += len; ptr += len; len -= len; - } } } @@ -850,18 +849,12 @@ static void log_write (moo_t* moo, moo_bitmask_t mask, const moo_ooch_t* msg, mo moo_oow_t ucslen, bcslen, msgidx; int n, logfd; - if (mask & MOO_LOG_STDERR) - { - logfd = 2; - } + if (mask & MOO_LOG_STDERR) logfd = 2; + else if (mask & MOO_LOG_STDOUT) logfd = 1; else { - if (mask & MOO_LOG_STDOUT) logfd = 1; - else - { - logfd = xtn->log.fd; - if (logfd <= -1) return; - } + logfd = xtn->log.fd; + if (logfd <= -1) return; } /* TODO: beautify the log message.