summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--hash.c6
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 00111bf3..00fff529 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2014-02-14 Kaz Kylheku <kaz@kylheku.com>
+ * hash.c (hash_update): Avoid double cdr.
+
+2014-02-14 Kaz Kylheku <kaz@kylheku.com>
+
* hash.c (inhash): Simplify with gethash_c.
2014-02-14 Kaz Kylheku <kaz@kylheku.com>
diff --git a/hash.c b/hash.c
index 6a4143d6..55906c2e 100644
--- a/hash.c
+++ b/hash.c
@@ -1008,8 +1008,10 @@ val hash_update(val hash, val fun)
{
val iter = hash_begin(hash);
val cell;
- while ((cell = hash_next(iter)) != nil)
- rplacd(cell, funcall1(fun, cdr(cell)));
+ while ((cell = hash_next(iter)) != nil) {
+ val *loc = cdr_l(cell);
+ set(*loc, funcall1(fun, *loc));
+ }
return hash;
}