1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 13:30:26 +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:
Ludovic Courtès 2011-01-24 23:11:21 +01:00
parent 2116e65843
commit d9544bf012

View file

@ -2052,14 +2052,12 @@ scm_i_set_port_encoding_x (SCM port, const char *enc)
/* Set the character encoding for this 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)
valid_enc = "ISO-8859-1";
pt->encoding = scm_gc_strdup (valid_enc, "port");
if (SCM_CELL_WORD_0 (port) & SCM_RDNG)
{
/* Open an input iconv conversion descriptor, from VALID_ENC