guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 14/15: Remove scm_c_write_unlocked


From: Andy Wingo
Subject: [Guile-commits] 14/15: Remove scm_c_write_unlocked
Date: Tue, 26 Apr 2016 21:38:56 +0000

wingo pushed a commit to branch wip-port-refactor
in repository guile.

commit d0b9d3b04d63d5add984b33d2371528297464623
Author: Andy Wingo <address@hidden>
Date:   Tue Apr 26 23:13:32 2016 +0200

    Remove scm_c_write_unlocked
    
    * libguile/ports.h (scm_c_write_bytes_unlocked): Remove.
    * libguile/ports.c (scm_c_write_bytes): Rename from
      scm_c_write_bytes_unlocked, make public, and return void.
      (scm_c_write): Rename from scm_c_write_unlocked.  Remove locked
      variant.
      (scm_lfwrite_unlocked): Call scm_c_write.
    * libguile/rw.c (scm_write_string_partial): Call scm_c_write.
---
 libguile/ports.c |   30 ++++--------------------------
 libguile/ports.h |    1 -
 libguile/rw.c    |    2 +-
 3 files changed, 5 insertions(+), 28 deletions(-)

diff --git a/libguile/ports.c b/libguile/ports.c
index 77dfc83..14be368 100644
--- a/libguile/ports.c
+++ b/libguile/ports.c
@@ -2529,8 +2529,8 @@ scm_i_write_unlocked (SCM port, SCM buf)
    scm_c_write writes the requested number of bytes.
 
    Warning: Doesn't update port line and column counts!  */
-static size_t
-scm_c_write_bytes_unlocked (SCM port, SCM src, size_t start, size_t count)
+void
+scm_c_write_bytes (SCM port, SCM src, size_t start, size_t count)
 #define FUNC_NAME "scm_c_write_bytes"
 {
   scm_t_port *pt;
@@ -2576,8 +2576,6 @@ scm_c_write_bytes_unlocked (SCM port, SCM src, size_t 
start, size_t count)
 
       scm_i_write_bytes_unlocked (port, src, start, count);
     }
-
-  return count;
 }
 #undef FUNC_NAME
 
@@ -2585,7 +2583,7 @@ scm_c_write_bytes_unlocked (SCM port, SCM src, size_t 
start, size_t count)
    Used when an application wants to write bytes stored in an area not
    managed by GC.  */
 void
-scm_c_write_unlocked (SCM port, const void *ptr, size_t size)
+scm_c_write (SCM port, const void *ptr, size_t size)
 #define FUNC_NAME "scm_c_write"
 {
   scm_t_port *pt;
@@ -2612,26 +2610,6 @@ scm_c_write_unlocked (SCM port, const void *ptr, size_t 
size)
 }
 #undef FUNC_NAME
 
-void
-scm_c_write (SCM port, const void *ptr, size_t size)
-{
-  scm_i_pthread_mutex_t *lock;
-  scm_c_lock_port (port, &lock);
-  scm_c_write_unlocked (port, ptr, size);
-  if (lock)
-    scm_i_pthread_mutex_unlock (lock);
-}
-
-void
-scm_c_write_bytes (SCM port, SCM src, size_t start, size_t count)
-{
-  scm_i_pthread_mutex_t *lock;
-  scm_c_lock_port (port, &lock);
-  scm_c_write_bytes_unlocked (port, src, start, count);
-  if (lock)
-    scm_i_pthread_mutex_unlock (lock);
-}
-
 /* scm_lfwrite
  *
  * This function differs from scm_c_write; it updates port line and
@@ -2641,7 +2619,7 @@ scm_lfwrite_unlocked (const char *ptr, size_t size, SCM 
port)
 {
   int saved_line;
 
-  scm_c_write_unlocked (port, ptr, size);
+  scm_c_write (port, ptr, size);
 
   saved_line = SCM_LINUM (port);
   for (; size; ptr++, size--)
diff --git a/libguile/ports.h b/libguile/ports.h
index 4019821..d916205 100644
--- a/libguile/ports.h
+++ b/libguile/ports.h
@@ -326,7 +326,6 @@ SCM_INTERNAL SCM scm_port_write_buffer (SCM port);
 SCM_API void scm_putc (char c, SCM port);
 SCM_API void scm_puts (const char *str_data, SCM port);
 SCM_API void scm_c_write (SCM port, const void *buffer, size_t size);
-SCM_API void scm_c_write_unlocked (SCM port, const void *buffer, size_t size);
 SCM_API void scm_c_write_bytes (SCM port, SCM src, size_t start, size_t count);
 SCM_API void scm_lfwrite (const char *ptr, size_t size, SCM port);
 SCM_API void scm_lfwrite_unlocked (const char *ptr, size_t size, SCM port);
diff --git a/libguile/rw.c b/libguile/rw.c
index b2f8f3a..b3d1f16 100644
--- a/libguile/rw.c
+++ b/libguile/rw.c
@@ -242,7 +242,7 @@ SCM_DEFINE (scm_write_string_partial, 
"write-string/partial", 1, 3, 0,
          flush.  */
       if (write_len < scm_port_buffer_can_put (write_buf))
        {
-          scm_c_write_unlocked (port, src, write_len);
+          scm_c_write (port, src, write_len);
          return scm_from_long (write_len);
        }
 



reply via email to

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