added hcl_seterrumsg() and hcl_seterrbfmt() in case the caller can't use variadic arguments
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ce47037b79
commit
0845e12a93
11
lib/err.c
11
lib/err.c
@ -242,6 +242,17 @@ void hcl_seterrnum (hcl_t* hcl, hcl_errnum_t errnum)
|
||||
hcl->errmsg.len = 0;
|
||||
}
|
||||
|
||||
void hcl_seterrbmsg (hcl_t* hcl, hcl_errnum_t errnum, const hcl_bch_t* errmsg)
|
||||
{
|
||||
hcl_seterrbfmt(hcl, errnum, "%hs", errmsg);
|
||||
}
|
||||
|
||||
|
||||
void hcl_seterrumsg (hcl_t* hcl, hcl_errnum_t errnum, const hcl_uch_t* errmsg)
|
||||
{
|
||||
hcl_seterrbfmt(hcl, errnum, "%ls", errmsg);
|
||||
}
|
||||
|
||||
|
||||
static int err_bcs (hcl_fmtout_t* fmtout, const hcl_bch_t* ptr, hcl_oow_t len)
|
||||
{
|
||||
|
18
lib/hcl.h
18
lib/hcl.h
@ -2025,13 +2025,25 @@ HCL_EXPORT void hcl_seterrnum (
|
||||
hcl_errnum_t errnum
|
||||
);
|
||||
|
||||
HCL_EXPORT void hcl_seterrbmsg (
|
||||
hcl_t* hcl,
|
||||
hcl_errnum_t errnum,
|
||||
const hcl_bch_t* errmsg
|
||||
);
|
||||
|
||||
HCL_EXPORT void hcl_seterrumsg (
|
||||
hcl_t* hcl,
|
||||
hcl_errnum_t errnum,
|
||||
const hcl_uch_t* errmsg
|
||||
);
|
||||
|
||||
HCL_EXPORT void hcl_seterrwithsyserr (
|
||||
hcl_t* hcl,
|
||||
int syserr_type,
|
||||
int syserr_code
|
||||
);
|
||||
|
||||
void hcl_seterrbfmtwithsyserr (
|
||||
HCL_EXPORT void hcl_seterrbfmtwithsyserr (
|
||||
hcl_t* hcl,
|
||||
int syserr_type,
|
||||
int syserr_code,
|
||||
@ -2039,7 +2051,7 @@ void hcl_seterrbfmtwithsyserr (
|
||||
...
|
||||
);
|
||||
|
||||
void hcl_seterrufmtwithsyserr (
|
||||
HCL_EXPORT void hcl_seterrufmtwithsyserr (
|
||||
hcl_t* hcl,
|
||||
int syserr_type,
|
||||
int syserr_code,
|
||||
@ -2089,8 +2101,10 @@ HCL_EXPORT const hcl_bch_t* hcl_geterrbmsg (
|
||||
|
||||
#if defined(HCL_OOCH_IS_UCH)
|
||||
# define hcl_geterrmsg hcl_geterrumsg
|
||||
# define hcl_seterrmsg hcl_seterrumsg
|
||||
#else
|
||||
# define hcl_geterrmsg hcl_geterrbmsg
|
||||
# define hcl_seterrmsg hcl_seterrbmsg
|
||||
#endif
|
||||
|
||||
HCL_EXPORT const hcl_ooch_t* hcl_backuperrmsg (
|
||||
|
@ -4038,13 +4038,10 @@ int hcl_attachio (hcl_t* hcl, hcl_ioimpl_t reader, hcl_ioimpl_t scanner, hcl_ioi
|
||||
hcl_ioinarg_t new_inarg;
|
||||
hcl_iooutarg_t new_outarg;
|
||||
|
||||
if (reader)
|
||||
if (!hcl->c)
|
||||
{
|
||||
if (!hcl->c)
|
||||
{
|
||||
if (init_compiler(hcl) <= -1) return -1;
|
||||
inited_compiler = 1;
|
||||
}
|
||||
if (init_compiler(hcl) <= -1) return -1;
|
||||
inited_compiler = 1;
|
||||
}
|
||||
|
||||
if (reader)
|
||||
|
Loading…
Reference in New Issue
Block a user