compacted code a bit
This commit is contained in:
parent
2a3c9c182c
commit
f91b85e0cf
@ -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)
|
||||||
@ -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, 1), &opt) <= -1) goto done;
|
||||||
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;
|
#else
|
||||||
|
mbs_ident = qse_wcstombsdup(ident, QSE_NULL, qse_awk_rtx_getmmgr(rtx));
|
||||||
mbs = qse_mbsdup(ident, qse_awk_rtx_getmmgr(rtx));
|
#endif
|
||||||
if (!mbs) goto done;
|
if (!mbs_ident) 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);
|
|
||||||
}
|
|
||||||
#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
|
|
||||||
|
|
||||||
|
openlog(mbs_ident, opt, fac);
|
||||||
rx = 0;
|
rx = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user