compacted code a bit

This commit is contained in:
hyung-hwan 2019-01-21 15:08:22 +00:00
parent 2a3c9c182c
commit f91b85e0cf

View File

@ -886,6 +886,7 @@ static int fnc_openlog (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
qse_awk_val_t* retv; qse_awk_val_t* retv;
qse_char_t* ident = QSE_NULL; qse_char_t* ident = QSE_NULL;
qse_size_t ident_len; qse_size_t ident_len;
qse_mchar_t* mbs_ident;
mod_ctx_t* mctx = fi->mod->ctx; mod_ctx_t* mctx = fi->mod->ctx;
#if defined(ENABLE_SYSLOG) #if defined(ENABLE_SYSLOG)
@ -900,31 +901,16 @@ static int fnc_openlog (qse_awk_rtx_t* rtx, const qse_awk_fnc_info_t* fi)
if (qse_awk_rtx_valtoint(rtx, qse_awk_rtx_getarg(rtx, 2), &fac) <= -1) goto done; if (qse_awk_rtx_valtoint(rtx, qse_awk_rtx_getarg(rtx, 2), &fac) <= -1) goto done;
#if defined(QSE_CHAR_IS_MCHAR) #if defined(QSE_CHAR_IS_MCHAR)
{ mbs_ident = qse_mbsdup(ident, qse_awk_rtx_getmmgr(rtx));
qse_mchar_t* mbs;
mbs = qse_mbsdup(ident, qse_awk_rtx_getmmgr(rtx));
if (!mbs) goto done;
if (mctx->log_ident) qse_awk_rtx_freemem (rtx, mctx->log_ident);
mctx->log_ident = mbs;
openlog(mbs, opt, fac);
}
#else #else
{ mbs_ident = qse_wcstombsdup(ident, QSE_NULL, qse_awk_rtx_getmmgr(rtx));
#endif
qse_mchar_t* mbs; if (!mbs_ident) goto done;
mbs = qse_wcstombsdup(ident, QSE_NULL, qse_awk_rtx_getmmgr(rtx));
if (!mbs) goto done;
if (mctx->log_ident) qse_awk_rtx_freemem (rtx, mctx->log_ident); if (mctx->log_ident) qse_awk_rtx_freemem (rtx, mctx->log_ident);
mctx->log_ident = mbs; mctx->log_ident = mbs_ident;
openlog (mbs, opt, fac);
}
#endif
openlog(mbs_ident, opt, fac);
rx = 0; rx = 0;
#endif #endif