guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] GNU Guile branch, master, updated. release_1-9-14-89-gda


From: Ludovic Courtès
Subject: [Guile-commits] GNU Guile branch, master, updated. release_1-9-14-89-gda288f5
Date: Mon, 24 Jan 2011 22:15:29 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".

http://git.savannah.gnu.org/cgit/guile.git/commit/?id=da288f50bf3c4950cf37d5e24b8ce2a21b367989

The branch, master has been updated
       via  da288f50bf3c4950cf37d5e24b8ce2a21b367989 (commit)
       via  d9544bf012b6e343c80b76bd5761b1583cc106a3 (commit)
      from  2116e658439068ce2c86795fdd0f96b9c1dab192 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit da288f50bf3c4950cf37d5e24b8ce2a21b367989
Author: Ludovic Courtès <address@hidden>
Date:   Mon Jan 24 23:13:03 2011 +0100

    Remove useless branches in the port code.
    
    * libguile/ports.c (scm_i_get_port_encoding): Remove useless `if'.
      (scm_set_port_encoding_x): Remove redundant `find_valid_encoding'
      call.

commit d9544bf012b6e343c80b76bd5761b1583cc106a3
Author: Ludovic Courtès <address@hidden>
Date:   Mon Jan 24 23:11:21 2011 +0100

    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.

-----------------------------------------------------------------------

Summary of changes:
 libguile/ports.c |   26 +++++---------------------
 1 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/libguile/ports.c b/libguile/ports.c
index 91abcb9..36f4b88 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -1977,10 +1977,7 @@ scm_i_get_port_encoding (SCM port)
     {
       scm_t_port *pt;
       pt = SCM_PTAB_ENTRY (port);
-      if (pt->encoding)
-       return pt->encoding;
-      else
-       return NULL;
+      return pt->encoding;
     }
 }
 
@@ -2052,14 +2049,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
@@ -2133,24 +2128,13 @@ SCM_DEFINE (scm_set_port_encoding_x, 
"set-port-encoding!", 2, 0, 0,
 #define FUNC_NAME s_scm_set_port_encoding_x
 {
   char *enc_str;
-  const char *valid_enc_str;
 
   SCM_VALIDATE_PORT (1, port);
   SCM_VALIDATE_STRING (2, enc);
 
   enc_str = scm_to_locale_string (enc);
-  valid_enc_str = find_valid_encoding (enc_str);
-  if (valid_enc_str == NULL)
-    {
-      free (enc_str);
-      scm_misc_error (FUNC_NAME, "invalid or unknown character encoding ~s",
-                     scm_list_1 (enc));
-    }
-  else
-    {
-      scm_i_set_port_encoding_x (port, valid_enc_str);
-      free (enc_str);
-    }
+  scm_i_set_port_encoding_x (port, enc_str);
+
   return SCM_UNSPECIFIED;
 }
 #undef FUNC_NAME


hooks/post-receive
-- 
GNU Guile



reply via email to

[Prev in Thread] Current Thread [Next in Thread]