summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-01-26 20:51:38 -0800
committerKaz Kylheku <kaz@kylheku.com>2012-01-26 20:51:38 -0800
commit5ae4654a4c6961d35b9bb4833934c51f17936df6 (patch)
tree43ba39fdd2256c06160e5e846677aeb6d3ba1317
parente0c091f0188aac47d95cce327b7a2f5eb83bd0d3 (diff)
downloadtxr-5ae4654a4c6961d35b9bb4833934c51f17936df6.tar.gz
txr-5ae4654a4c6961d35b9bb4833934c51f17936df6.tar.bz2
txr-5ae4654a4c6961d35b9bb4833934c51f17936df6.zip
* eval.c (op_modplace): Fix warning caught by gcc, but not g++.
* lib.c (replace_list): Fix code that is valid C++ but not C.
-rw-r--r--ChangeLog6
-rw-r--r--eval.c2
-rw-r--r--lib.c4
3 files changed, 9 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 549fd7ea..24f4f8d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,12 @@
2012-01-26 Kaz Kylheku <kaz@kylheku.com>
+ * eval.c (op_modplace): Fix warning caught by gcc, but not g++.
+
+ * lib.c (replace_list): Fix code that is valid C++ but not C.
+
+2012-01-26 Kaz Kylheku <kaz@kylheku.com>
+
* lib.c (replace_list): Always convert the input items to a list,
even in the trivial case that an empty list is being replaced.
Allow a string to be the replacement (split into a list of
diff --git a/eval.c b/eval.c
index af712130..8ae828fe 100644
--- a/eval.c
+++ b/eval.c
@@ -782,7 +782,7 @@ static val op_modplace(val form, val env)
/* TODO: dispatch these with hash table. */
val sym = car(place);
if (sym == dwim_s) {
- val ret;
+ val ret = nil;
loc = dwim_loc(place, env, op, newval, &ret);
if (loc == 0)
return ret;
diff --git a/lib.c b/lib.c
index e00f8d1f..881d2c0c 100644
--- a/lib.c
+++ b/lib.c
@@ -496,12 +496,12 @@ val replace_list(val list, val from, val to, val items)
else if (from == t)
from = nil;
else if (lt(from, zero))
- from = plus(from, len ? len : len = length(list));
+ from = plus(from, len ? len : (len = length(list)));
if (to == t)
to = nil;
if (to && lt(to, zero))
- to = plus(to, len ? len : len = length(list));
+ to = plus(to, len ? len : (len = length(list)));
if (!to || (len && ge(to, len))) {
if (from && zerop(from)) {