1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-03 08:10:31 +02:00

Simplify vector constructor

* libguile/vectors.c: Remove redundant list check.
This commit is contained in:
Daniel Llorens 2020-02-13 12:26:19 +01:00
parent 5a2f73faf5
commit 82d8f025b1

View file

@ -122,20 +122,16 @@ SCM_DEFINE (scm_vector, "vector", 0, 0, 1,
"@end lisp") "@end lisp")
#define FUNC_NAME s_scm_vector #define FUNC_NAME s_scm_vector
{ {
SCM res; long len;
SCM *data;
long i, len;
SCM_VALIDATE_LIST_COPYLEN (1, l, len); SCM_VALIDATE_LIST_COPYLEN (1, l, len);
res = scm_c_make_vector (len, SCM_UNSPECIFIED); SCM res = scm_c_make_vector (len, SCM_UNSPECIFIED);
data = SCM_I_VECTOR_WELTS (res); SCM *data = SCM_I_VECTOR_WELTS (res);
i = 0;
while (scm_is_pair (l) && i < len) for (long i=0; i < len; ++i)
{ {
data[i] = SCM_CAR (l); data[i] = SCM_CAR (l);
l = SCM_CDR (l); l = SCM_CDR (l);
i += 1;
} }
return res; return res;