mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-11 22:31:12 +02:00
* print.c (scm_simple_format): Bugfix: Coerce port before using it.
This commit is contained in:
parent
cdaf0a20af
commit
daba1a710d
1 changed files with 19 additions and 13 deletions
|
@ -960,18 +960,24 @@ SCM_DEFINE (scm_simple_format, "simple-format", 2, 0, 1,
|
||||||
char *start;
|
char *start;
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if (SCM_EQ_P (destination, SCM_BOOL_T)) {
|
if (SCM_EQ_P (destination, SCM_BOOL_T))
|
||||||
destination = scm_cur_outp;
|
{
|
||||||
} else if (SCM_FALSEP (destination)) {
|
destination = scm_cur_outp;
|
||||||
fReturnString = 1;
|
}
|
||||||
destination = scm_mkstrport (SCM_INUM0,
|
else if (SCM_FALSEP (destination))
|
||||||
scm_make_string (SCM_INUM0, SCM_UNDEFINED),
|
{
|
||||||
SCM_OPN | SCM_WRTNG,
|
fReturnString = 1;
|
||||||
FUNC_NAME);
|
destination = scm_mkstrport (SCM_INUM0,
|
||||||
} else {
|
scm_make_string (SCM_INUM0, SCM_UNDEFINED),
|
||||||
SCM_VALIDATE_OPORT_VALUE (1,destination);
|
SCM_OPN | SCM_WRTNG,
|
||||||
}
|
FUNC_NAME);
|
||||||
SCM_VALIDATE_STRING(2,message);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SCM_VALIDATE_OPORT_VALUE (1, destination);
|
||||||
|
destination = SCM_COERCE_OUTPORT (destination);
|
||||||
|
}
|
||||||
|
SCM_VALIDATE_STRING (2, message);
|
||||||
SCM_VALIDATE_REST_ARGUMENT (args);
|
SCM_VALIDATE_REST_ARGUMENT (args);
|
||||||
|
|
||||||
start = SCM_ROCHARS (message);
|
start = SCM_ROCHARS (message);
|
||||||
|
@ -999,7 +1005,7 @@ SCM_DEFINE (scm_simple_format, "simple-format", 2, 0, 1,
|
||||||
if (fReturnString)
|
if (fReturnString)
|
||||||
answer = scm_strport_to_string (destination);
|
answer = scm_strport_to_string (destination);
|
||||||
|
|
||||||
return scm_return_first(answer,message);
|
return scm_return_first (answer, message);
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue