diff --git a/moo/lib/exec.c b/moo/lib/exec.c index 1b2c7e8..a3b9920 100644 --- a/moo/lib/exec.c +++ b/moo/lib/exec.c @@ -5305,11 +5305,11 @@ static int __execute (moo_t* moo) /* it emulates thisContext blockCopy: nargs ofTmprCount: ntmprs */ MOO_ASSERT (moo, moo->sp >= 2); - MOO_ASSERT (moo, MOO_CLASSOF(moo, MOO_STACK_GETTOP(moo)) == moo->_small_integer); + MOO_ASSERT (moo, MOO_OOP_IS_SMOOI(MOO_STACK_GETTOP(moo))); ntmprs = MOO_OOP_TO_SMOOI(MOO_STACK_GETTOP(moo)); MOO_STACK_POP (moo); - MOO_ASSERT (moo, MOO_CLASSOF(moo, MOO_STACK_GETTOP(moo)) == moo->_small_integer); + MOO_ASSERT (moo, MOO_OOP_IS_SMOOI(MOO_STACK_GETTOP(moo))); nargs = MOO_OOP_TO_SMOOI(MOO_STACK_GETTOP(moo)); MOO_STACK_POP (moo); diff --git a/moo/lib/logfmtv.h b/moo/lib/logfmtv.h index b5c4cfd..35079d7 100644 --- a/moo/lib/logfmtv.h +++ b/moo/lib/logfmtv.h @@ -73,16 +73,20 @@ #define PUT_OOCH(c,n) do { \ int xx; \ - if ((xx = data->putch (moo, data->mask, c, n)) <= -1) goto oops; \ - if (xx == 0) goto done; \ - data->count += n; \ + if (n > 0) { \ + if ((xx = data->putch (moo, data->mask, c, n)) <= -1) goto oops; \ + if (xx == 0) goto done; \ + data->count += n; \ + } \ } while (0) #define PUT_OOCS(ptr,len) do { \ int xx; \ - if ((xx = data->putcs (moo, data->mask, ptr, len)) <= -1) goto oops; \ - if (xx == 0) goto done; \ - data->count += len; \ + if (len > 0) { \ + if ((xx = data->putcs (moo, data->mask, ptr, len)) <= -1) goto oops; \ + if (xx == 0) goto done; \ + data->count += len; \ + } \ } while (0) static int logfmtv (moo_t* moo, const fmtchar_t* fmt, moo_fmtout_t* data, va_list ap, outbfmt_t outbfmt)