code touch up

This commit is contained in:
hyunghwan.chung 2019-04-16 15:43:54 +00:00
parent aa5d739e56
commit 9dde92b188
3 changed files with 8 additions and 15 deletions

View File

@ -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[0] = ndigits_xh + ndigits_yh;
tmplen[1] = ndigits_yl + ndigits_yh + 1; tmplen[1] = ndigits_yl + ndigits_yh + 1;
if (tmplen[1] < tmplen[0]) tmplen[1] = tmplen[0]; 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; if (!tmp[1]) goto oops;
/* make a temporary for (a0 + a1) and (a0 * b0) */ /* 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; const char* _digitc;
int radix; int radix;
radix = flagged_radix & 0xFF; radix = flagged_radix & MOO_INTTOSTR_RADIXMASK;
_digitc = _digitc_array[!!(flagged_radix & MOO_INTTOSTR_LOWERCASE)]; _digitc = _digitc_array[!!(flagged_radix & MOO_INTTOSTR_LOWERCASE)];
MOO_ASSERT (moo, radix >= 2 && radix <= 36); 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; int radix;
const char* _digitc; const char* _digitc;
radix = flagged_radix & 0xFF; radix = flagged_radix & MOO_INTTOSTR_RADIXMASK;
_digitc = _digitc_array[!!(flagged_radix & MOO_INTTOSTR_LOWERCASE)]; _digitc = _digitc_array[!!(flagged_radix & MOO_INTTOSTR_LOWERCASE)];
MOO_ASSERT (moo, radix >= 2 && radix <= 36); MOO_ASSERT (moo, radix >= 2 && radix <= 36);

View File

@ -920,7 +920,7 @@ static MOO_INLINE int print_formatted (moo_t* moo, moo_ooi_t nargs, moo_fmtout_d
if (ignore_rcv) if (ignore_rcv)
{ {
arg = MOO_STACK_GETARG(moo, nargs, 0); arg = MOO_STACK_GETARG(moo, nargs, 0);
arg_state.idx = 1; arg_state.idx = 1;
} }
else else

View File

@ -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; xtn->log.out.len += len;
ptr += len; ptr += len;
len -= 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; moo_oow_t ucslen, bcslen, msgidx;
int n, logfd; int n, logfd;
if (mask & MOO_LOG_STDERR) if (mask & MOO_LOG_STDERR) logfd = 2;
{ else if (mask & MOO_LOG_STDOUT) logfd = 1;
logfd = 2;
}
else else
{ {
if (mask & MOO_LOG_STDOUT) logfd = 1; logfd = xtn->log.fd;
else if (logfd <= -1) return;
{
logfd = xtn->log.fd;
if (logfd <= -1) return;
}
} }
/* TODO: beautify the log message. /* TODO: beautify the log message.