made hcl immune to an error number/message set in the log_write callback

This commit is contained in:
2018-02-22 04:35:55 +00:00
parent 6e4a8f6081
commit a39e38cc8d
5 changed files with 45 additions and 18 deletions

View File

@ -297,8 +297,17 @@ const hcl_ooch_t* hcl_backuperrmsg (hcl_t* hcl)
return hcl->errmsg.tmpbuf.ooch;
}
void hcl_seterrnum (hcl_t* hcl, hcl_errnum_t errnum)
{
if (hcl->shuterr) return;
hcl->errnum = errnum;
hcl->errmsg.len = 0;
}
void hcl_seterrwithsyserr (hcl_t* hcl, int syserr)
{
if (hcl->shuterr) return;
if (hcl->vmprim.syserrstrb)
{
hcl->vmprim.syserrstrb (hcl, syserr, hcl->errmsg.tmpbuf.bch, HCL_COUNTOF(hcl->errmsg.tmpbuf.bch));
@ -323,6 +332,8 @@ void hcl_setsynerrbfmt (hcl_t* hcl, hcl_synerrnum_t num, const hcl_ioloc_t* loc,
{
static hcl_bch_t syntax_error[] = "syntax error - ";
if (hcl->shuterr) return;
if (msgfmt)
{
va_list ap;
@ -372,6 +383,8 @@ void hcl_setsynerrufmt (hcl_t* hcl, hcl_synerrnum_t num, const hcl_ioloc_t* loc,
{
static hcl_bch_t syntax_error[] = "syntax error - ";
if (hcl->shuterr) return;
if (msgfmt)
{
va_list ap;