summaryrefslogtreecommitdiff
path: root/libguile/weaks.c
diff options
context:
space:
mode:
authorDirk Herrmann <dirk@dirk-herrmanns-seiten.de>2001-03-30 15:03:23 +0000
committerDirk Herrmann <dirk@dirk-herrmanns-seiten.de>2001-03-30 15:03:23 +0000
commit22a52da14dd86801cc3a36837601929effde1904 (patch)
tree3742d5d516018e6fcf53ace4d6f68762e285891c /libguile/weaks.c
parent8715ff170378801396575750c54f32fba3a0b624 (diff)
downloadguile-22a52da14dd86801cc3a36837601929effde1904.tar.gz
* Replaced a lot of calls to SCM_C[AD]R with more appropriate macros.
* Minor cleanups to hashtable implementation. * Minor code beautifications.
Diffstat (limited to 'libguile/weaks.c')
-rw-r--r--libguile/weaks.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/libguile/weaks.c b/libguile/weaks.c
index c01da2c61..c6cf591bb 100644
--- a/libguile/weaks.c
+++ b/libguile/weaks.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995,1996,1998, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1998,2000,2001 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -88,17 +88,22 @@ SCM_DEFINE (scm_weak_vector, "weak-vector", 0, 0, 1,
#define FUNC_NAME s_scm_weak_vector
{
SCM res;
- register SCM *data;
+ SCM *data;
long i;
+ /* Dirk:FIXME:: In case of multiple threads, the list might get corrupted
+ while the vector is being created. */
i = scm_ilength (l);
SCM_ASSERT (i >= 0, l, SCM_ARG1, FUNC_NAME);
res = scm_make_weak_vector (SCM_MAKINUM (i), SCM_UNSPECIFIED);
data = SCM_VELTS (res);
- for (;
- i && SCM_CONSP (l);
- --i, l = SCM_CDR (l))
- *data++ = SCM_CAR (l);
+
+ while (!SCM_NULLP (l))
+ {
+ *data++ = SCM_CAR (l);
+ l = SCM_CDR (l);
+ }
+
return res;
}
#undef FUNC_NAME