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_char_t* ident = QSE_NULL;
qse_size_t ident_len;
qse_mchar_t* mbs_ident;
mod_ctx_t* mctx = fi->mod->ctx;
#if defined(ENABLE_SYSLOG)
@ -899,32 +900,17 @@ 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, 1), &opt) <= -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)
{
qse_mchar_t* mbs;
mbs = qse_mbsdup(ident, qse_awk_rtx_getmmgr(rtx));
if (!mbs) goto done;
#if defined(QSE_CHAR_IS_MCHAR)
mbs_ident = qse_mbsdup(ident, qse_awk_rtx_getmmgr(rtx));
#else
mbs_ident = qse_wcstombsdup(ident, QSE_NULL, qse_awk_rtx_getmmgr(rtx));
#endif
if (!mbs_ident) goto done;
if (mctx->log_ident) qse_awk_rtx_freemem (rtx, mctx->log_ident);
mctx->log_ident = mbs;
openlog(mbs, opt, fac);
}
#else
{
qse_mchar_t* mbs;
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);
mctx->log_ident = mbs;
openlog (mbs, opt, fac);
}
#endif
mctx->log_ident = mbs_ident;
openlog(mbs_ident, opt, fac);
rx = 0;
#endif