1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

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.
This commit is contained in:
Andy Wingo 2016-04-26 23:13:32 +02:00
parent 105e36543f
commit d0b9d3b04d
3 changed files with 5 additions and 28 deletions

View file

@ -2529,8 +2529,8 @@ scm_i_write_unlocked (SCM port, SCM buf)
scm_c_write writes the requested number of bytes. scm_c_write writes the requested number of bytes.
Warning: Doesn't update port line and column counts! */ Warning: Doesn't update port line and column counts! */
static size_t void
scm_c_write_bytes_unlocked (SCM port, SCM src, size_t start, size_t count) scm_c_write_bytes (SCM port, SCM src, size_t start, size_t count)
#define FUNC_NAME "scm_c_write_bytes" #define FUNC_NAME "scm_c_write_bytes"
{ {
scm_t_port *pt; 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); scm_i_write_bytes_unlocked (port, src, start, count);
} }
return count;
} }
#undef FUNC_NAME #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 Used when an application wants to write bytes stored in an area not
managed by GC. */ managed by GC. */
void 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" #define FUNC_NAME "scm_c_write"
{ {
scm_t_port *pt; scm_t_port *pt;
@ -2612,26 +2610,6 @@ scm_c_write_unlocked (SCM port, const void *ptr, size_t size)
} }
#undef FUNC_NAME #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 /* scm_lfwrite
* *
* This function differs from scm_c_write; it updates port line and * 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; int saved_line;
scm_c_write_unlocked (port, ptr, size); scm_c_write (port, ptr, size);
saved_line = SCM_LINUM (port); saved_line = SCM_LINUM (port);
for (; size; ptr++, size--) for (; size; ptr++, size--)

View file

@ -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_putc (char c, SCM port);
SCM_API void scm_puts (const char *str_data, 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 (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_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 (const char *ptr, size_t size, SCM port);
SCM_API void scm_lfwrite_unlocked (const char *ptr, size_t size, SCM port); SCM_API void scm_lfwrite_unlocked (const char *ptr, size_t size, SCM port);

View file

@ -242,7 +242,7 @@ SCM_DEFINE (scm_write_string_partial, "write-string/partial", 1, 3, 0,
flush. */ flush. */
if (write_len < scm_port_buffer_can_put (write_buf)) 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); return scm_from_long (write_len);
} }