mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 05:50:26 +02:00
Remove unneeded SMOB mark/free procedures.
* libguile/bytevectors.c (free_bytevector): Remove. (scm_bootstrap_bytevectors): Update accordingly. * libguile/r6rs-ports.c (bip_mark, cbp_mark, bop_free, bop_proc_mark): Remove. (initialize_bytevector_input_ports, initialize_custom_binary_input_ports, initialize_bytevector_output_ports, initialize_custom_binary_output_ports): Update accordingly.
This commit is contained in:
parent
1ac8a47f01
commit
3b882d69fb
2 changed files with 0 additions and 66 deletions
|
@ -370,25 +370,6 @@ bytevector_equal_p (SCM bv1, SCM bv2)
|
|||
return scm_bytevector_eq_p (bv1, bv2);
|
||||
}
|
||||
|
||||
static size_t
|
||||
free_bytevector (SCM bv)
|
||||
{
|
||||
|
||||
if (!SCM_BYTEVECTOR_INLINE_P (bv))
|
||||
{
|
||||
unsigned c_len;
|
||||
signed char *c_bv;
|
||||
|
||||
c_bv = SCM_BYTEVECTOR_CONTENTS (bv);
|
||||
c_len = SCM_BYTEVECTOR_LENGTH (bv);
|
||||
|
||||
scm_gc_free (c_bv, c_len, SCM_GC_BYTEVECTOR);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* General operations. */
|
||||
|
||||
|
@ -2086,7 +2067,6 @@ scm_bootstrap_bytevectors (void)
|
|||
generalized-vector API may want to access bytevectors even though
|
||||
`(rnrs bytevector)' hasn't been loaded. */
|
||||
scm_tc16_bytevector = scm_make_smob_type ("bytevector", 0);
|
||||
scm_set_smob_free (scm_tc16_bytevector, free_bytevector);
|
||||
scm_set_smob_print (scm_tc16_bytevector, print_bytevector);
|
||||
scm_set_smob_equalp (scm_tc16_bytevector, bytevector_equal_p);
|
||||
|
||||
|
|
|
@ -104,13 +104,6 @@ make_bip (SCM bv)
|
|||
return port;
|
||||
}
|
||||
|
||||
static SCM
|
||||
bip_mark (SCM port)
|
||||
{
|
||||
/* Mark the underlying bytevector. */
|
||||
return (SCM_PACK (SCM_STREAM (port)));
|
||||
}
|
||||
|
||||
static int
|
||||
bip_fill_input (SCM port)
|
||||
{
|
||||
|
@ -176,7 +169,6 @@ initialize_bytevector_input_ports (void)
|
|||
scm_make_port_type ("r6rs-bytevector-input-port", bip_fill_input,
|
||||
NULL);
|
||||
|
||||
scm_set_port_mark (bytevector_input_port_type, bip_mark);
|
||||
scm_set_port_seek (bytevector_input_port_type, bip_seek);
|
||||
}
|
||||
|
||||
|
@ -207,16 +199,6 @@ SCM_DEFINE (scm_open_bytevector_input_port,
|
|||
#define SCM_CBP_CLOSE_PROC(_port) \
|
||||
SCM_SIMPLE_VECTOR_REF (SCM_PACK (SCM_STREAM (_port)), 3)
|
||||
|
||||
static SCM
|
||||
cbp_mark (SCM port)
|
||||
{
|
||||
/* Mark the underlying method and object vector. */
|
||||
if (SCM_OPENP (port))
|
||||
return SCM_PACK (SCM_STREAM (port));
|
||||
else
|
||||
return SCM_BOOL_F;
|
||||
}
|
||||
|
||||
static scm_t_off
|
||||
cbp_seek (SCM port, scm_t_off offset, int whence)
|
||||
#define FUNC_NAME "cbp_seek"
|
||||
|
@ -421,7 +403,6 @@ initialize_custom_binary_input_ports (void)
|
|||
scm_make_port_type ("r6rs-custom-binary-input-port",
|
||||
cbip_fill_input, NULL);
|
||||
|
||||
scm_set_port_mark (custom_binary_input_port_type, cbp_mark);
|
||||
scm_set_port_seek (custom_binary_input_port_type, cbp_seek);
|
||||
scm_set_port_close (custom_binary_input_port_type, cbp_close);
|
||||
}
|
||||
|
@ -852,23 +833,6 @@ make_bop (void)
|
|||
return (scm_values (scm_list_2 (port, bop_proc)));
|
||||
}
|
||||
|
||||
static size_t
|
||||
bop_free (SCM port)
|
||||
{
|
||||
/* The port itself is necessarily freed _after_ the bop proc, since the bop
|
||||
proc holds a reference to it. Thus we can safely free the internal
|
||||
buffer when the bop becomes unreferenced. */
|
||||
scm_t_bop_buffer *buf;
|
||||
|
||||
buf = SCM_BOP_BUFFER (port);
|
||||
if (buf->buffer)
|
||||
scm_gc_free (buf->buffer, buf->total_len, SCM_GC_BOP);
|
||||
|
||||
scm_gc_free (buf, sizeof (* buf), SCM_GC_BOP);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Write SIZE octets from DATA to PORT. */
|
||||
static void
|
||||
bop_write (SCM port, const void *data, size_t size)
|
||||
|
@ -952,14 +916,6 @@ SCM_SMOB_APPLY (bytevector_output_port_procedure,
|
|||
return bv;
|
||||
}
|
||||
|
||||
SCM_SMOB_MARK (bytevector_output_port_procedure, bop_proc_mark,
|
||||
bop_proc)
|
||||
{
|
||||
/* Mark the port associated with BOP_PROC. */
|
||||
return (SCM_PACK (SCM_SMOB_DATA (bop_proc)));
|
||||
}
|
||||
|
||||
|
||||
SCM_DEFINE (scm_open_bytevector_output_port,
|
||||
"open-bytevector-output-port", 0, 1, 0,
|
||||
(SCM transcoder),
|
||||
|
@ -983,7 +939,6 @@ initialize_bytevector_output_ports (void)
|
|||
NULL, bop_write);
|
||||
|
||||
scm_set_port_seek (bytevector_output_port_type, bop_seek);
|
||||
scm_set_port_free (bytevector_output_port_type, bop_free);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1102,7 +1057,6 @@ initialize_custom_binary_output_ports (void)
|
|||
scm_make_port_type ("r6rs-custom-binary-output-port",
|
||||
NULL, cbop_write);
|
||||
|
||||
scm_set_port_mark (custom_binary_output_port_type, cbp_mark);
|
||||
scm_set_port_seek (custom_binary_output_port_type, cbp_seek);
|
||||
scm_set_port_close (custom_binary_output_port_type, cbp_close);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue