mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 21:40:33 +02:00
Always initialize a port's encoding name.
* libguile/ports.c (scm_i_set_port_encoding_x): Always initialize PT->encoding to something non-NULL. This fixes callers of `scm_encoding_error' such that they always pass a non-NULL encoding name. Reported by Matei Conovici.
This commit is contained in:
parent
2116e65843
commit
d9544bf012
1 changed files with 2 additions and 4 deletions
|
@ -2052,14 +2052,12 @@ scm_i_set_port_encoding_x (SCM port, const char *enc)
|
||||||
|
|
||||||
/* Set the character encoding for this port. */
|
/* Set the character encoding for this port. */
|
||||||
pt = SCM_PTAB_ENTRY (port);
|
pt = SCM_PTAB_ENTRY (port);
|
||||||
if (valid_enc == NULL)
|
|
||||||
pt->encoding = NULL;
|
|
||||||
else
|
|
||||||
pt->encoding = scm_gc_strdup (valid_enc, "port");
|
|
||||||
|
|
||||||
if (valid_enc == NULL)
|
if (valid_enc == NULL)
|
||||||
valid_enc = "ISO-8859-1";
|
valid_enc = "ISO-8859-1";
|
||||||
|
|
||||||
|
pt->encoding = scm_gc_strdup (valid_enc, "port");
|
||||||
|
|
||||||
if (SCM_CELL_WORD_0 (port) & SCM_RDNG)
|
if (SCM_CELL_WORD_0 (port) & SCM_RDNG)
|
||||||
{
|
{
|
||||||
/* Open an input iconv conversion descriptor, from VALID_ENC
|
/* Open an input iconv conversion descriptor, from VALID_ENC
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue