mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 06:41:13 +02:00
(check_map_args): Move check_map_error label and elt variable outside
of loop scope so that we do not jump past the initialization of elt.
This commit is contained in:
parent
3e2073bd24
commit
705f4f57ee
1 changed files with 14 additions and 11 deletions
|
@ -1222,20 +1222,15 @@ check_map_args (SCM argv,
|
||||||
const char *who)
|
const char *who)
|
||||||
{
|
{
|
||||||
long i;
|
long i;
|
||||||
|
SCM elt;
|
||||||
|
|
||||||
for (i = SCM_SIMPLE_VECTOR_LENGTH (argv) - 1; i >= 1; i--)
|
for (i = SCM_SIMPLE_VECTOR_LENGTH (argv) - 1; i >= 1; i--)
|
||||||
{
|
{
|
||||||
SCM elt = SCM_SIMPLE_VECTOR_REF (argv, i);
|
|
||||||
long elt_len;
|
long elt_len;
|
||||||
|
elt = SCM_SIMPLE_VECTOR_REF (argv, i);
|
||||||
|
|
||||||
if (!(scm_is_null (elt) || scm_is_pair (elt)))
|
if (!(scm_is_null (elt) || scm_is_pair (elt)))
|
||||||
{
|
goto check_map_error;
|
||||||
check_map_error:
|
|
||||||
if (gf)
|
|
||||||
scm_apply_generic (gf, scm_cons (proc, args));
|
|
||||||
else
|
|
||||||
scm_wrong_type_arg (who, i + 2, elt);
|
|
||||||
}
|
|
||||||
|
|
||||||
elt_len = srfi1_ilength (elt);
|
elt_len = srfi1_ilength (elt);
|
||||||
if (elt_len < -1)
|
if (elt_len < -1)
|
||||||
|
@ -1244,10 +1239,18 @@ check_map_args (SCM argv,
|
||||||
if (len < 0 || (elt_len >= 0 && elt_len < len))
|
if (len < 0 || (elt_len >= 0 && elt_len < len))
|
||||||
len = elt_len;
|
len = elt_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
/* i == 0 */
|
{
|
||||||
goto check_map_error;
|
/* i == 0 */
|
||||||
|
elt = SCM_EOL;
|
||||||
|
check_map_error:
|
||||||
|
if (gf)
|
||||||
|
scm_apply_generic (gf, scm_cons (proc, args));
|
||||||
|
else
|
||||||
|
scm_wrong_type_arg (who, i + 2, elt);
|
||||||
|
}
|
||||||
|
|
||||||
scm_remember_upto_here_1 (argv);
|
scm_remember_upto_here_1 (argv);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue