mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 14:00:21 +02:00
* numbers.c (scm_string_to_number): Signal an error if radix is
less than two. (Thanks to Jorgen Schaefer.) * print.c (scm_write, scm_display, scm_newline, scm_write_char): Don't assume that the current output port is valid. Somebody might close it. (Thanks to Bernard Urban.)
This commit is contained in:
parent
dc4d930b43
commit
3eb7e6ee5e
2 changed files with 13 additions and 9 deletions
|
@ -2450,7 +2450,11 @@ scm_string_to_number (str, radix)
|
|||
if (SCM_UNBNDP (radix))
|
||||
radix = SCM_MAKINUM (10L);
|
||||
else
|
||||
SCM_ASSERT (SCM_INUMP (radix), radix, SCM_ARG2, s_string_to_number);
|
||||
{
|
||||
SCM_ASSERT (SCM_INUMP (radix), radix, SCM_ARG2, s_string_to_number);
|
||||
SCM_ASSERT (SCM_INUM (radix) >= 2, radix, SCM_OUTOFRANGE,
|
||||
s_number_to_string);
|
||||
}
|
||||
SCM_ASSERT (SCM_NIMP (str) && SCM_ROSTRINGP (str),
|
||||
str, SCM_ARG1, s_string_to_number);
|
||||
answer = scm_istring2number (SCM_ROCHARS (str),
|
||||
|
|
|
@ -917,8 +917,8 @@ scm_write (obj, port)
|
|||
{
|
||||
if (SCM_UNBNDP (port))
|
||||
port = scm_cur_outp;
|
||||
else
|
||||
SCM_ASSERT (scm_valid_oport_value_p (port), port, SCM_ARG2, s_write);
|
||||
|
||||
SCM_ASSERT (scm_valid_oport_value_p (port), port, SCM_ARG2, s_write);
|
||||
|
||||
scm_prin1 (obj, port, 1);
|
||||
#ifdef HAVE_PIPE
|
||||
|
@ -940,8 +940,8 @@ scm_display (obj, port)
|
|||
{
|
||||
if (SCM_UNBNDP (port))
|
||||
port = scm_cur_outp;
|
||||
else
|
||||
SCM_ASSERT (scm_valid_oport_value_p (port), port, SCM_ARG2, s_display);
|
||||
|
||||
SCM_ASSERT (scm_valid_oport_value_p (port), port, SCM_ARG2, s_display);
|
||||
|
||||
scm_prin1 (obj, port, 0);
|
||||
#ifdef HAVE_PIPE
|
||||
|
@ -961,8 +961,8 @@ scm_newline (port)
|
|||
{
|
||||
if (SCM_UNBNDP (port))
|
||||
port = scm_cur_outp;
|
||||
else
|
||||
SCM_ASSERT (scm_valid_oport_value_p (port), port, SCM_ARG1, s_newline);
|
||||
|
||||
SCM_ASSERT (scm_valid_oport_value_p (port), port, SCM_ARG1, s_newline);
|
||||
|
||||
scm_putc ('\n', SCM_COERCE_OUTPORT (port));
|
||||
return SCM_UNSPECIFIED;
|
||||
|
@ -977,8 +977,8 @@ scm_write_char (chr, port)
|
|||
{
|
||||
if (SCM_UNBNDP (port))
|
||||
port = scm_cur_outp;
|
||||
else
|
||||
SCM_ASSERT (scm_valid_oport_value_p (port), port, SCM_ARG2, s_write_char);
|
||||
|
||||
SCM_ASSERT (scm_valid_oport_value_p (port), port, SCM_ARG2, s_write_char);
|
||||
|
||||
SCM_ASSERT (SCM_ICHRP (chr), chr, SCM_ARG1, s_write_char);
|
||||
scm_putc ((int) SCM_ICHR (chr), SCM_COERCE_OUTPORT (port));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue