fixed the premature termination issue in logfmtv

This commit is contained in:
hyunghwan.chung 2018-02-21 08:48:57 +00:00
parent 00e815b8ff
commit 4aa9a711ad
2 changed files with 12 additions and 8 deletions

View File

@ -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);

View File

@ -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)