[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] branch wip-vector-cleanup updated: Simplify vector const
From: |
Daniel Llorens |
Subject: |
[Guile-commits] branch wip-vector-cleanup updated: Simplify vector constructor |
Date: |
Thu, 13 Feb 2020 06:43:27 -0500 |
This is an automated email from the git hooks/post-receive script.
lloda pushed a commit to branch wip-vector-cleanup
in repository guile.
The following commit(s) were added to refs/heads/wip-vector-cleanup by this
push:
new 1458a7c Simplify vector constructor
1458a7c is described below
commit 1458a7c4b8d489f3db7b4b2def7874ef92db0672
Author: Daniel Llorens <address@hidden>
AuthorDate: Thu Feb 13 12:26:19 2020 +0100
Simplify vector constructor
* libguile/vectors.c: Remove redundant list check.
---
libguile/vectors.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/libguile/vectors.c b/libguile/vectors.c
index 16823d3..7f12442 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 (int i=0; i < len; ++i)
{
data[i] = SCM_CAR (l);
l = SCM_CDR (l);
- i += 1;
}
return res;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] branch wip-vector-cleanup updated: Simplify vector constructor,
Daniel Llorens <=