mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-20 02:30:23 +02:00
Fixed `list->weak-vector'.
* libguile/vectors.c (scm_i_allocate_weak_vector): Removed. (MAKE_WEAK_VECTOR): New macro. (allocate_weak_vector): New. (scm_i_make_weak_vector): New. (scm_i_make_weak_vector_from_list): New. * libguile/vectors.h: Updated. * libguile/weaks.c (scm_make_weak_vector): Use `scm_i_make_weak_vector ()'. (scm_weak_vector): Use `scm_i_make_weak_vector_from_list ()'. git-archimport-id: lcourtes@laas.fr--2005-libre/guile-core--boehm-gc--1.9--patch-13
This commit is contained in:
parent
4650cdd20d
commit
d525e4f9a2
3 changed files with 75 additions and 53 deletions
|
@ -76,7 +76,7 @@ SCM_DEFINE (scm_make_weak_vector, "make-weak-vector", 1, 1, 0,
|
|||
"empty list.")
|
||||
#define FUNC_NAME s_scm_make_weak_vector
|
||||
{
|
||||
return scm_i_allocate_weak_vector (0, size, fill);
|
||||
return scm_i_make_weak_vector (0, size, fill);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
@ -92,26 +92,7 @@ SCM_DEFINE (scm_weak_vector, "weak-vector", 0, 0, 1,
|
|||
"the same way @code{list->vector} would.")
|
||||
#define FUNC_NAME s_scm_weak_vector
|
||||
{
|
||||
scm_t_array_handle handle;
|
||||
SCM res, *data;
|
||||
long i;
|
||||
|
||||
i = scm_ilength (l);
|
||||
SCM_ASSERT (i >= 0, l, SCM_ARG1, FUNC_NAME);
|
||||
|
||||
res = scm_make_weak_vector (scm_from_int (i), SCM_UNSPECIFIED);
|
||||
data = scm_vector_writable_elements (res, &handle, NULL, NULL);
|
||||
|
||||
while (scm_is_pair (l) && i > 0)
|
||||
{
|
||||
*data++ = SCM_CAR (l);
|
||||
l = SCM_CDR (l);
|
||||
i--;
|
||||
}
|
||||
|
||||
scm_array_handle_release (&handle);
|
||||
|
||||
return res;
|
||||
return scm_i_make_weak_vector_from_list (0, l);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue