diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-01-26 20:51:38 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-01-26 20:51:38 -0800 |
commit | 75df8bf9079c5edf23f6b6d3c4b1c5902ddf9653 (patch) | |
tree | 43ba39fdd2256c06160e5e846677aeb6d3ba1317 | |
parent | 7002405ab17218baa4e2366a47860a5770d18650 (diff) | |
download | txr-75df8bf9079c5edf23f6b6d3c4b1c5902ddf9653.tar.gz txr-75df8bf9079c5edf23f6b6d3c4b1c5902ddf9653.tar.bz2 txr-75df8bf9079c5edf23f6b6d3c4b1c5902ddf9653.zip |
* eval.c (op_modplace): Fix warning caught by gcc, but not g++.txr-55
* lib.c (replace_list): Fix code that is valid C++ but not C.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | eval.c | 2 | ||||
-rw-r--r-- | lib.c | 4 |
3 files changed, 9 insertions, 3 deletions
@@ -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 @@ -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; @@ -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)) { |