diff --git a/moo/lib/moo-cmn.h b/moo/lib/moo-cmn.h index ebd7904..a111d2a 100644 --- a/moo/lib/moo-cmn.h +++ b/moo/lib/moo-cmn.h @@ -429,6 +429,12 @@ struct moo_ntime_t #define MOO_CMP_NTIME(a,b) (((a)->sec == (b)->sec)? ((a)->nsec - (b)->nsec): ((a)->sec - (b)->sec)) +/* if time has been normalized properly, nsec must be equal to or + * greater than 0. */ +#define MOO_IS_NEG_NTIME(x) ((x)->sec < 0) +#define MOO_IS_POS_NTIME(x) ((x)->sec > 0 || ((x)->sec == 0 && (x)->nsec > 0)) +#define MOO_IS_ZERO_NTIME(x) ((x)->sec == 0 && (x)->nsec == 0) + /* ========================================================================= * PRIMITIVE MACROS * ========================================================================= */ diff --git a/moo/lib/moo-prv.h b/moo/lib/moo-prv.h index 4c44d60..443f5ed 100644 --- a/moo/lib/moo-prv.h +++ b/moo/lib/moo-prv.h @@ -1006,7 +1006,7 @@ extern "C" { #endif /* ========================================================================= */ -/* err.c */ +/* err.c */ /* ========================================================================= */ void moo_seterrbfmtv ( diff --git a/moo/lib/std.c b/moo/lib/std.c index 1d81a6c..c841e81 100644 --- a/moo/lib/std.c +++ b/moo/lib/std.c @@ -279,7 +279,6 @@ struct xtn_t struct { - /*moo_bitmask_t mask;*/ int fd; int fd_flag; /* bitwise OR'ed fo logfd_flag_t bits */ @@ -849,11 +848,6 @@ static void log_write (moo_t* moo, moo_bitmask_t mask, const moo_ooch_t* msg, mo } else { -#if 0 - if (!(xtn->log.mask & mask & ~MOO_LOG_ALL_LEVELS)) return; /* check log types */ - if (!(xtn->log.mask & mask & ~MOO_LOG_ALL_TYPES)) return; /* check log levels */ -#endif - if (mask & MOO_LOG_STDOUT) logfd = 1; else { @@ -3254,11 +3248,8 @@ static int parse_logoptb (moo_t* moo, const moo_bch_t* str, moo_oow_t* xpathlen, cm = moo_find_bchar_in_bcstr(str, ','); pathlen = cm - str; -#if 0 - logmask = xtn->log.mask; -#else logmask = 0; -#endif + do { flt = cm + 1; @@ -3313,7 +3304,6 @@ static int parse_logoptu (moo_t* moo, const moo_uch_t* str, moo_oow_t* xpathlen, cm = moo_find_uchar_in_ucstr(str, ','); pathlen = cm - str; - /*logmask = xtn->log.mask;*/ logmask = 0; do { @@ -3375,7 +3365,6 @@ static int handle_logoptb (moo_t* moo, const moo_bch_t* str) return -1; } - /*xtn->log.mask = logmask;*/ xtn->log.fd_flag |= LOGFD_OPENED_HERE; #if defined(HAVE_ISATTY) if (isatty(xtn->log.fd)) xtn->log.fd_flag |= LOGFD_TTY; @@ -3406,7 +3395,6 @@ static int handle_logoptu (moo_t* moo, const moo_uch_t* str) return -1; } - /*xtn->log.mask = logmask;*/ xtn->log.fd_flag |= LOGFD_OPENED_HERE; #if defined(HAVE_ISATTY) if (isatty(xtn->log.fd)) xtn->log.fd_flag |= LOGFD_TTY; @@ -3532,11 +3520,9 @@ static MOO_INLINE void reset_log_to_default (xtn_t* xtn) #if defined(HAVE_ISATTY) if (isatty(xtn->log.fd)) xtn->log.fd_flag |= LOGFD_TTY; #endif - /*xtn->log.mask = MOO_LOG_ALL_LEVELS | MOO_LOG_ALL_TYPES;*/ #else xtn->log.fd = -1; xtn->log.fd_flag = 0; - /*xtn->log.mask = 0;*/ #endif }