diff --git a/lib/hcl.h b/lib/hcl.h index 7525633..f642a8b 100644 --- a/lib/hcl.h +++ b/lib/hcl.h @@ -84,11 +84,11 @@ enum hcl_errnum_t HCL_EIOERR, /**< I/O error */ HCL_EECERR, /**< encoding conversion error */ HCL_EBUFFULL, /**< buffer full */ - HCL_ESYNERR, /**< syntax error */ - HCL_ECALL, /**< runtime error - cannot call */ + HCL_ESYNERR, /**< syntax error */ + HCL_ECALL, /**< runtime error - cannot call */ - HCL_ERECALL, /**< runtime error - cannot call again */ - HCL_ECALLARG /**< runtime error - wrong number of arguments to call */ + HCL_ERECALL, /**< runtime error - cannot call again */ + HCL_ECALLARG /**< runtime error - wrong number of arguments to call */ }; typedef enum hcl_errnum_t hcl_errnum_t; diff --git a/lib/logfmt.c b/lib/logfmt.c index ca5e84d..8cab139 100644 --- a/lib/logfmt.c +++ b/lib/logfmt.c @@ -667,8 +667,6 @@ void hcl_seterrbfmt (hcl_t* hcl, hcl_errnum_t errnum, const hcl_bch_t* fmt, ...) hcl_fmtout_t fo; if (hcl->shuterr) return; - - hcl->errnum = errnum; hcl->errmsg.len = 0; fo.mask = 0; /* not used */ @@ -678,6 +676,8 @@ void hcl_seterrbfmt (hcl_t* hcl, hcl_errnum_t errnum, const hcl_bch_t* fmt, ...) va_start (ap, fmt); _errbfmtv (hcl, fmt, &fo, ap); va_end (ap); + + hcl->errnum = errnum; } void hcl_seterrufmt (hcl_t* hcl, hcl_errnum_t errnum, const hcl_uch_t* fmt, ...) @@ -686,8 +686,6 @@ void hcl_seterrufmt (hcl_t* hcl, hcl_errnum_t errnum, const hcl_uch_t* fmt, ...) hcl_fmtout_t fo; if (hcl->shuterr) return; - - hcl->errnum = errnum; hcl->errmsg.len = 0; fo.mask = 0; /* not used */ @@ -697,6 +695,8 @@ void hcl_seterrufmt (hcl_t* hcl, hcl_errnum_t errnum, const hcl_uch_t* fmt, ...) va_start (ap, fmt); _errufmtv (hcl, fmt, &fo, ap); va_end (ap); + + hcl->errnum = errnum; } @@ -705,8 +705,6 @@ void hcl_seterrbfmtv (hcl_t* hcl, hcl_errnum_t errnum, const hcl_bch_t* fmt, va_ hcl_fmtout_t fo; if (hcl->shuterr) return; - - hcl->errnum = errnum; hcl->errmsg.len = 0; fo.mask = 0; /* not used */ @@ -714,6 +712,7 @@ void hcl_seterrbfmtv (hcl_t* hcl, hcl_errnum_t errnum, const hcl_bch_t* fmt, va_ fo.putcs = put_errcs; _errbfmtv (hcl, fmt, &fo, ap); + hcl->errnum = errnum; } void hcl_seterrufmtv (hcl_t* hcl, hcl_errnum_t errnum, const hcl_uch_t* fmt, va_list ap) @@ -721,8 +720,6 @@ void hcl_seterrufmtv (hcl_t* hcl, hcl_errnum_t errnum, const hcl_uch_t* fmt, va_ hcl_fmtout_t fo; if (hcl->shuterr) return; - - hcl->errnum = errnum; hcl->errmsg.len = 0; fo.mask = 0; /* not used */ @@ -730,6 +727,7 @@ void hcl_seterrufmtv (hcl_t* hcl, hcl_errnum_t errnum, const hcl_uch_t* fmt, va_ fo.putcs = put_errcs; _errufmtv (hcl, fmt, &fo, ap); + hcl->errnum = errnum; } /* -------------------------------------------------------------------------- diff --git a/lib/read.c b/lib/read.c index 79ebcec..5769ff1 100644 --- a/lib/read.c +++ b/lib/read.c @@ -2407,7 +2407,7 @@ int hcl_unreadchar (hcl_t* hcl, const hcl_iolxc_t* c) { if (hcl->c->nungots >= HCL_COUNTOF(hcl->c->ungot)) { - hcl_seterrnum (hcl, HCL_EBUFFULL); + hcl_seterrbfmt (hcl, HCL_EBUFFULL, "character unread buffer full"); return -1; }