removed unused variables and corrected flaws in error message conversion functions
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
hyung-hwan 2023-11-07 20:18:06 +09:00
parent 984c1f62a9
commit 38e7d85312
4 changed files with 17 additions and 14 deletions

View File

@ -236,7 +236,7 @@ static int is_in_class_init_scope (hcl_t* hcl)
static int is_in_class_method_scope (hcl_t* hcl)
{
hcl_oow_t i, j;
hcl_oow_t i;
for (i = hcl->c->fnblk.depth + 1; i > 0; )
{
@ -256,7 +256,7 @@ static int is_in_class_method_scope (hcl_t* hcl)
static int find_variable_backward (hcl_t* hcl, const hcl_cnode_t* token, hcl_var_info_t* vi)
{
hcl_oow_t i, j;
hcl_oow_t i;
const hcl_oocs_t* name;
HCL_ASSERT (hcl, hcl->c->fnblk.depth >= 0);

View File

@ -166,41 +166,45 @@ static char* synerrstr[] =
/* --------------------------------------------------------------------------
* ERROR NUMBER TO STRING CONVERSION
* -------------------------------------------------------------------------- */
static hcl_bch_t e_unknown_b[] = {'u','n','k','n','o','w','n',' ','e','r','r','o','r','\0'};
static hcl_uch_t e_unknown_u[] = {'u','n','k','n','o','w','n',' ','e','r','r','o','r','\0'};
#if defined(HCL_OOCH_IS_BCH)
# define e_unknown e_unknown_b
#else
# define e_unknown e_unknown_u
#endif
const hcl_ooch_t* hcl_errnum_to_errstr (hcl_errnum_t errnum)
{
static hcl_ooch_t e_unknown[] = {'u','n','k','n','o','w','n',' ','e','r','r','o','r','\0'};
return (errnum >= 0 && errnum < HCL_COUNTOF(errstr))? errstr[errnum]: e_unknown;
}
const hcl_bch_t* hcl_errnum_to_errbcstr (hcl_errnum_t errnum, hcl_bch_t* buf, hcl_oow_t len)
{
static hcl_bch_t e_unknown[] = {'u','n','k','n','o','w','n',' ','e','r','r','o','r','\0'};
/* it's ok to copy without conversion because the messages above are simple acsii text */
#if defined(HCL_OOCH_IS_BCH)
hcl_copy_bcstr(buf, len, (errnum >= 0 && errnum < HCL_COUNTOF(errstr))? errstr[errnum]: e_unknown);
hcl_copy_bcstr(buf, len, (errnum >= 0 && errnum < HCL_COUNTOF(errstr))? errstr[errnum]: e_unknown_b);
#else
hcl_copy_ucstr_to_bcstr(buf, len, (errnum >= 0 && errnum < HCL_COUNTOF(errstr))? errstr[errnum]: e_unknown);
hcl_copy_ucstr_to_bcstr(buf, len, (errnum >= 0 && errnum < HCL_COUNTOF(errstr))? errstr[errnum]: e_unknown_u);
#endif
return buf;
}
const hcl_uch_t* hcl_errnum_to_errucstr (hcl_errnum_t errnum, hcl_uch_t* buf, hcl_oow_t len)
{
static hcl_uch_t e_unknown[] = {'u','n','k','n','o','w','n',' ','e','r','r','o','r','\0'};
/* it's ok to copy without conversion because the messages above are simple acsii text */
#if defined(HCL_OOCH_IS_BCH)
hcl_copy_bcstr_to_ucstr(buf, len, (errnum >= 0 && errnum < HCL_COUNTOF(errstr))? errstr[errnum]: e_unknown);
hcl_copy_bcstr_to_ucstr(buf, len, (errnum >= 0 && errnum < HCL_COUNTOF(errstr))? errstr[errnum]: e_unknown_b);
#else
hcl_copy_ucstr(buf, len, (errnum >= 0 && errnum < HCL_COUNTOF(errstr))? errstr[errnum]: e_unknown);
hcl_copy_ucstr(buf, len, (errnum >= 0 && errnum < HCL_COUNTOF(errstr))? errstr[errnum]: e_unknown_u);
#endif
return buf;
}
static const hcl_bch_t* synerr_to_errstr (hcl_synerrnum_t errnum)
{
static hcl_bch_t e_unknown[] = "unknown error";
return (errnum >= 0 && errnum < HCL_COUNTOF(synerrstr))? synerrstr[errnum]: e_unknown;
return (errnum >= 0 && errnum < HCL_COUNTOF(synerrstr))? synerrstr[errnum]: e_unknown_b;
}
/* --------------------------------------------------------------------------

View File

@ -818,7 +818,6 @@ static hcl_pfrc_t pf_va_count (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs)
static hcl_pfrc_t pf_va_get (hcl_t* hcl, hcl_mod_t* mod, hcl_ooi_t nargs)
{
hcl_oop_t ret;
hcl_oop_context_t ctx;
hcl_ooi_t attr_mask, va, fixed_nargs, nrvars, nlvars, nvaargs;
hcl_oow_t index;

View File

@ -2883,7 +2883,7 @@ static int open_pipes (hcl_t* hcl, int p[2])
ioctl (p[0], FIONBIO, (char*)&flags, HCL_SIZEOF(flags));
ioctl (p[1], FIONBIO, (char*)&flags, HCL_SIZEOF(flags));
#elif defined(HAVE_PIPE2) && defined(O_CLOEXEC) && defined(O_NONBLOCK)
/* do nothing */
/* do nothing */
#else
#if defined(FD_CLOEXEC)
flags = fcntl(p[0], F_GETFD);