guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-271-g05d7f


From: Mark H Weaver
Subject: [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.7-271-g05d7f76
Date: Mon, 01 Apr 2013 21:12:15 +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=05d7f76296dc9fa21e0abd1ce6105a042905f48e

The branch, stable-2.0 has been updated
       via  05d7f76296dc9fa21e0abd1ce6105a042905f48e (commit)
      from  21bbe22a14a75fab54a5a8563fad63851a18fee3 (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 05d7f76296dc9fa21e0abd1ce6105a042905f48e
Author: Mark H Weaver <address@hidden>
Date:   Sun Mar 31 19:52:31 2013 -0400

    Move the port alist from the hash table to the internal port structure.
    
    * libguile/ports-internal.h (struct scm_port_internal): Add 'alist'
      member.
    
    * libguile/ports.c (scm_i_port_alist, scm_i_set_port_alist_x): New
      internal functions.
      (scm_i_port_weak_hash): Update comment: the hash table is no longer
      used to store the port's alist.
      (scm_new_port_table_entry): Initialize 'alist'.  Store SCM_BOOL_F in
      the port weak hash, not SCM_EOL.
    
    * libguile/ports.h (scm_i_port_alist, scm_i_set_port_alist_x): Add
      protoypes.
    
    * libguile/read.c (set_port_read_option, init_read_options): Access the
      port's alist via 'scm_i_port_alist' and 'scm_i_set_port_alist_x'.

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

Summary of changes:
 libguile/ports-internal.h |    1 +
 libguile/ports.c          |   19 ++++++++++++++++---
 libguile/ports.h          |    2 ++
 libguile/read.c           |   16 ++++++----------
 4 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/libguile/ports-internal.h b/libguile/ports-internal.h
index bd25f3e..73a788f 100644
--- a/libguile/ports-internal.h
+++ b/libguile/ports-internal.h
@@ -48,6 +48,7 @@ struct scm_port_internal
 {
   scm_t_port_encoding_mode encoding_mode;
   scm_t_iconv_descriptors *iconv_descriptors;
+  SCM alist;
 };
 
 typedef struct scm_port_internal scm_t_port_internal;
diff --git a/libguile/ports.c b/libguile/ports.c
index 8f3df9c..becdbed 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -241,6 +241,18 @@ scm_set_port_input_waiting (scm_t_bits tc, int 
(*input_waiting) (SCM))
   scm_ptobs[SCM_TC2PTOBNUM (tc)].input_waiting = input_waiting;
 }
 
+SCM
+scm_i_port_alist (SCM port)
+{
+  return SCM_PORT_GET_INTERNAL (port)->alist;
+}
+
+void
+scm_i_set_port_alist_x (SCM port, SCM alist)
+{
+  SCM_PORT_GET_INTERNAL (port)->alist = alist;
+}
+
 
 
 SCM_DEFINE (scm_char_ready_p, "char-ready?", 0, 1, 0, 
@@ -538,8 +550,7 @@ scm_i_dynwind_current_load_port (SCM port)
 
 /*
   We need a global registry of ports to flush them all at exit, and to
-  get all the ports matching a file descriptor.  The associated values
-  are alists, where additional information can be associated with ports.
+  get all the ports matching a file descriptor.
  */
 SCM scm_i_port_weak_hash;
 
@@ -634,10 +645,12 @@ scm_new_port_table_entry (scm_t_bits tag)
   entry->input_cd = pti;   /* XXX pointer to the internal port structure */
   entry->output_cd = NULL; /* XXX unused */
 
+  pti->alist = SCM_EOL;
+
   SCM_SET_CELL_TYPE (z, tag);
   SCM_SETPTAB_ENTRY (z, entry);
 
-  scm_hashq_set_x (scm_i_port_weak_hash, z, SCM_EOL);
+  scm_hashq_set_x (scm_i_port_weak_hash, z, SCM_BOOL_F);
 
   /* For each new port, register a finalizer so that it port type's free
      function can be invoked eventually.  */
diff --git a/libguile/ports.h b/libguile/ports.h
index 95545cd..53d5081 100644
--- a/libguile/ports.h
+++ b/libguile/ports.h
@@ -316,6 +316,8 @@ SCM_API SCM scm_port_column (SCM port);
 SCM_API SCM scm_set_port_column_x (SCM port, SCM line);
 SCM_API SCM scm_port_filename (SCM port);
 SCM_API SCM scm_set_port_filename_x (SCM port, SCM filename);
+SCM_INTERNAL SCM scm_i_port_alist (SCM port);
+SCM_INTERNAL void scm_i_set_port_alist_x (SCM port, SCM alist);
 SCM_INTERNAL const char *scm_i_default_port_encoding (void);
 SCM_INTERNAL void scm_i_set_default_port_encoding (const char *);
 SCM_INTERNAL void scm_i_set_port_encoding_x (SCM port, const char *str);
diff --git a/libguile/read.c b/libguile/read.c
index 222891b..6457952 100644
--- a/libguile/read.c
+++ b/libguile/read.c
@@ -2143,9 +2143,9 @@ SCM_DEFINE (scm_file_encoding, "file-encoding", 1, 0, 0,
 /* Per-port read options.
 
    We store per-port read options in the 'port-read-options' key of the
-   port's alist, which is stored in 'scm_i_port_weak_hash'.  The value
-   stored in the alist is a single integer that contains a two-bit field
-   for each read option.
+   port's alist, which is stored in the internal port structure.  The
+   value stored in the alist is a single integer that contains a two-bit
+   field for each read option.
 
    If a bit field contains READ_OPTION_INHERIT (3), that indicates that
    the applicable value should be inherited from the corresponding
@@ -2184,8 +2184,7 @@ set_port_read_option (SCM port, int option, int new_value)
   unsigned int read_options;
 
   new_value &= READ_OPTION_MASK;
-  scm_i_scm_pthread_mutex_lock (&scm_i_port_table_mutex);
-  alist = scm_hashq_ref (scm_i_port_weak_hash, port, SCM_BOOL_F);
+  alist = scm_i_port_alist (port);
   scm_read_options = scm_assq_ref (alist, sym_port_read_options);
   if (scm_is_unsigned_integer (scm_read_options, 0, READ_OPTIONS_MAX_VALUE))
     read_options = scm_to_uint (scm_read_options);
@@ -2195,8 +2194,7 @@ set_port_read_option (SCM port, int option, int new_value)
   read_options |= new_value << option;
   scm_read_options = scm_from_uint (read_options);
   alist = scm_assq_set_x (alist, sym_port_read_options, scm_read_options);
-  scm_hashq_set_x (scm_i_port_weak_hash, port, alist);
-  scm_i_pthread_mutex_unlock (&scm_i_port_table_mutex);
+  scm_i_set_port_alist_x (port, alist);
 }
 
 /* Set OPTS and PORT's case-insensitivity according to VALUE. */
@@ -2234,10 +2232,8 @@ init_read_options (SCM port, scm_t_read_opts *opts)
   SCM alist, val, scm_read_options;
   unsigned int read_options, x;
 
-  scm_i_scm_pthread_mutex_lock (&scm_i_port_table_mutex);
-  alist = scm_hashq_ref (scm_i_port_weak_hash, port, SCM_BOOL_F);
+  alist = scm_i_port_alist (port);
   scm_read_options = scm_assq_ref (alist, sym_port_read_options);
-  scm_i_pthread_mutex_unlock (&scm_i_port_table_mutex);
 
   if (scm_is_unsigned_integer (scm_read_options, 0, READ_OPTIONS_MAX_VALUE))
     read_options = scm_to_uint (scm_read_options);


hooks/post-receive
-- 
GNU Guile



reply via email to

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