diff options
author | Daniel Llorens <lloda@sarc.name> | 2020-02-13 12:26:19 +0100 |
---|---|---|
committer | Daniel Llorens <lloda@sarc.name> | 2020-04-09 16:59:39 +0200 |
commit | 82d8f025b11137781ab8761145cf1e1894eb0c8e (patch) | |
tree | 346b0b1881a57efdb4ae467bc876c28977adf246 | |
parent | 5a2f73faf55aae856ca57d5b838a332580303bfd (diff) | |
download | guile-82d8f025b11137781ab8761145cf1e1894eb0c8e.tar.gz |
Simplify vector constructor
* libguile/vectors.c: Remove redundant list check.
-rw-r--r-- | libguile/vectors.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/libguile/vectors.c b/libguile/vectors.c index add267cbd..81fb9bb6b 100644 --- a/libguile/vectors.c +++ b/libguile/vectors.c @@ -122,20 +122,16 @@ SCM_DEFINE (scm_vector, "vector", 0, 0, 1, "@end lisp") #define FUNC_NAME s_scm_vector { - SCM res; - SCM *data; - long i, len; - + long len; SCM_VALIDATE_LIST_COPYLEN (1, l, len); + + SCM res = scm_c_make_vector (len, SCM_UNSPECIFIED); + SCM *data = SCM_I_VECTOR_WELTS (res); - res = scm_c_make_vector (len, SCM_UNSPECIFIED); - 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); l = SCM_CDR (l); - i += 1; } return res; |