From 1d2acf489b3dd69dc5d33169e58ee29d69e443df Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 16 Jul 2021 14:17:07 +0000 Subject: [PATCH] added MIO_ERROR macros --- mio/lib/fmt.c | 8 ++++---- mio/lib/mio-prv.h | 2 +- mio/lib/mio.h | 8 ++++++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/mio/lib/fmt.c b/mio/lib/fmt.c index 768eb9c..6000338 100644 --- a/mio/lib/fmt.c +++ b/mio/lib/fmt.c @@ -1399,7 +1399,7 @@ static int log_oocs (mio_fmtout_t* fmtout, const mio_ooch_t* ptr, mio_oow_t len) mio->log.ptr[mio->log.len++] = '\n'; } - prim_write_log (mio, mio->log.last_mask, mio->log.ptr, mio->log.len); + MIO_SYS_WRITE_LOG (mio, mio->log.last_mask, mio->log.ptr, mio->log.len); mio->log.len = 0; } @@ -1443,7 +1443,7 @@ redo: /* no line ending - append a line terminator */ mio->log.ptr[mio->log.len++] = '\n'; } - prim_write_log (mio, mio->log.last_mask, mio->log.ptr, mio->log.len); + MIO_SYS_WRITE_LOG (mio, mio->log.last_mask, mio->log.ptr, mio->log.len); mio->log.len = 0; } @@ -1557,7 +1557,7 @@ mio_ooi_t mio_logbfmtv (mio_t* mio, mio_bitmask_t mask, const mio_bch_t* fmt, va if (mio->log.len > 0 && mio->log.ptr[mio->log.len - 1] == '\n') { - prim_write_log (mio, mio->log.last_mask, mio->log.ptr, mio->log.len); + MIO_SYS_WRITE_LOG (mio, mio->log.last_mask, mio->log.ptr, mio->log.len); mio->log.len = 0; } @@ -1611,7 +1611,7 @@ mio_ooi_t mio_logufmtv (mio_t* mio, mio_bitmask_t mask, const mio_uch_t* fmt, va if (mio->log.len > 0 && mio->log.ptr[mio->log.len - 1] == '\n') { - prim_write_log (mio, mio->log.last_mask, mio->log.ptr, mio->log.len); + MIO_SYS_WRITE_LOG (mio, mio->log.last_mask, mio->log.ptr, mio->log.len); mio->log.len = 0; } diff --git a/mio/lib/mio-prv.h b/mio/lib/mio-prv.h index 1371b1f..d681d3a 100644 --- a/mio/lib/mio-prv.h +++ b/mio/lib/mio-prv.h @@ -101,7 +101,7 @@ /* i don't want an error raised inside the callback to override * the existing error number and message. */ -#define prim_write_log(mio,mask,ptr,len) do { \ +#define MIO_SYS_WRITE_LOG(mio,mask,ptr,len) do { \ int __shuterr = (mio)->_shuterr; \ (mio)->_shuterr = 1; \ mio_sys_writelog (mio, mask, ptr, len); \ diff --git a/mio/lib/mio.h b/mio/lib/mio.h index c56ed5b..ee742df 100644 --- a/mio/lib/mio.h +++ b/mio/lib/mio.h @@ -588,6 +588,14 @@ typedef enum mio_log_mask_t mio_log_mask_t; #define MIO_INFO5(mio,fmt,a1,a2,a3,a4,a5) MIO_LOG5(mio, MIO_LOG_INFO | MIO_LOG_UNTYPED, fmt, a1, a2, a3, a4, a5) #define MIO_INFO6(mio,fmt,a1,a2,a3,a4,a5,a6) MIO_LOG6(mio, MIO_LOG_INFO | MIO_LOG_UNTYPED, fmt, a1, a2, a3, a4, a5, a6) +#define MIO_ERROR0(mio,fmt) MIO_LOG0(mio, MIO_LOG_ERROR | MIO_LOG_UNTYPED, fmt) +#define MIO_ERROR1(mio,fmt,a1) MIO_LOG1(mio, MIO_LOG_ERROR | MIO_LOG_UNTYPED, fmt, a1) +#define MIO_ERROR2(mio,fmt,a1,a2) MIO_LOG2(mio, MIO_LOG_ERROR | MIO_LOG_UNTYPED, fmt, a1, a2) +#define MIO_ERROR3(mio,fmt,a1,a2,a3) MIO_LOG3(mio, MIO_LOG_ERROR | MIO_LOG_UNTYPED, fmt, a1, a2, a3) +#define MIO_ERROR4(mio,fmt,a1,a2,a3,a4) MIO_LOG4(mio, MIO_LOG_ERROR | MIO_LOG_UNTYPED, fmt, a1, a2, a3, a4) +#define MIO_ERROR5(mio,fmt,a1,a2,a3,a4,a5) MIO_LOG5(mio, MIO_LOG_ERROR | MIO_LOG_UNTYPED, fmt, a1, a2, a3, a4, a5) +#define MIO_ERROR6(mio,fmt,a1,a2,a3,a4,a5,a6) MIO_LOG6(mio, MIO_LOG_ERROR | MIO_LOG_UNTYPED, fmt, a1, a2, a3, a4, a5, a6) + /* ========================================================================= */ enum mio_sys_mux_cmd_t