summaryrefslogtreecommitdiff
path: root/libguile/srfi-4.c
diff options
context:
space:
mode:
authorMarius Vollmer <mvo@zagadka.de>2004-10-27 19:25:14 +0000
committerMarius Vollmer <mvo@zagadka.de>2004-10-27 19:25:14 +0000
commitfaa00365939c4f311bac3d7f634bcc39ff0e6a61 (patch)
treed15fa3206bd687260e06644c48a7d751a1128768 /libguile/srfi-4.c
parent2a7bd7383309b3beb7f31a24e94844589a48380d (diff)
downloadguile-faa00365939c4f311bac3d7f634bcc39ff0e6a61.tar.gz
* srfi-4.c (take_uvec): New.
(alloc_uvec): Use it. * srfi-4.h, srfi-4.i.c (scm_take_u8vector, etc): New.
Diffstat (limited to 'libguile/srfi-4.c')
-rw-r--r--libguile/srfi-4.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/libguile/srfi-4.c b/libguile/srfi-4.c
index 07b33ded9..39cb07331 100644
--- a/libguile/srfi-4.c
+++ b/libguile/srfi-4.c
@@ -217,13 +217,19 @@ uvec_assert (int type, SCM obj)
scm_wrong_type_arg_msg (NULL, 0, obj, uvec_names[type]);
}
+static SCM
+take_uvec (int type, const void *base, size_t len)
+{
+ SCM_RETURN_NEWSMOB3 (scm_tc16_uvec, type, len, (scm_t_bits) base);
+}
+
/* Create a new, uninitialized homogeneous numeric vector of type TYPE
with space for LEN elements. */
static SCM
-alloc_uvec (int type, size_t c_len)
+alloc_uvec (int type, size_t len)
{
- void *base = scm_gc_malloc (c_len * uvec_sizes[type], uvec_names[type]);
- SCM_RETURN_NEWSMOB3 (scm_tc16_uvec, type, c_len, (scm_t_bits) base);
+ void *base = scm_gc_malloc (len * uvec_sizes[type], uvec_names[type]);
+ return take_uvec (type, base, len);
}
/* GCC doesn't seem to want to optimize unused switch clauses away,
@@ -573,6 +579,9 @@ scm_uniform_vector_release (SCM uvec)
/* Nothing to do right now, but this function might come in handy
when uniform vectors need to be locked when giving away a pointer
to their elements.
+
+ Also, a call to scm_uniform_vector acts like
+ scm_remember_upto_here, which is needed in any case.
*/
}