From fa9e0f538ade940259f41c051846d69b76311db1 Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Sun, 4 Feb 2018 16:38:28 +0000 Subject: [PATCH] removed unneeded log flushing --- moo/lib/moo.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/moo/lib/moo.c b/moo/lib/moo.c index ec7256b..b531369 100644 --- a/moo/lib/moo.c +++ b/moo/lib/moo.c @@ -171,9 +171,10 @@ void moo_fini (moo_t* moo) moo_rbt_walk (&moo->modtab, unload_module, moo); /* unload all modules */ moo_rbt_fini (&moo->modtab); - if (moo->log.ptr) + if (moo->log.len > 0) { /* flush pending log messages just in case. */ + MOO_ASSERT (moo, moo->log.ptr != MOO_NULL); moo->vmprim.log_write (moo, moo->log.last_mask, moo->log.ptr, moo->log.len); } @@ -183,12 +184,13 @@ void moo_fini (moo_t* moo) if (cb->fini) cb->fini (moo); } - if (moo->log.ptr) + if (moo->log.len > 0) { /* flush pending log message that could be generated by the fini * callbacks. however, the actual logging might not be produced at * this point because one of the callbacks could arrange to stop * logging */ + MOO_ASSERT (moo, moo->log.ptr != MOO_NULL); moo->vmprim.log_write (moo, moo->log.last_mask, moo->log.ptr, moo->log.len); }