summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--lib.c14
2 files changed, 13 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index e0c9b9c4..c0e9cd59 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2012-02-28 Kaz Kylheku <kaz@kylheku.com>
+
+ * lib.c (sub_list, replace_list, lazy_sub_str, sub_str, replace_str,
+ sub_vec, replace_vec): Regression: replace incorrect zerop(to)
+ test with to == zero, because to is not necessarily a number.
+
2012-02-27 Kaz Kylheku <kaz@kylheku.com>
* txr.vim: Recognize backslash-newline break in regexes.
diff --git a/lib.c b/lib.c
index edba4f1c..9aaa9f04 100644
--- a/lib.c
+++ b/lib.c
@@ -445,7 +445,7 @@ val sub_list(val list, val from, val to)
from = nil;
else if (lt(from, zero)) {
from = plus(from, len = length(list));
- if (zerop(to))
+ if (to == zero)
to = nil;
}
@@ -499,7 +499,7 @@ val replace_list(val list, val items, val from, val to)
from = nil;
else if (lt(from, zero)) {
from = plus(from, len ? len : (len = length(list)));
- if (zerop(to))
+ if (to == zero)
to = len;
}
@@ -1490,7 +1490,7 @@ static val lazy_sub_str(val lstr, val from, val to)
from = plus(from, len = length_str(lstr));
from = max2(zero, from);
- if (zerop(to))
+ if (to == zero)
to = t;
}
@@ -1545,7 +1545,7 @@ val sub_str(val str_in, val from, val to)
return null_string;
else if (lt(from, zero)) {
from = plus(from, len);
- if (zerop(to))
+ if (to == zero)
to = len;
}
@@ -1586,7 +1586,7 @@ val replace_str(val str_in, val items, val from, val to)
from = len;
else if (lt(from, zero)) {
from = plus(from, len);
- if (zerop(to))
+ if (to == zero)
to = len;
}
@@ -2956,7 +2956,7 @@ val sub_vec(val vec_in, val from, val to)
from = len;
else if (lt(from, zero)) {
from = plus(from, len);
- if (zerop(to))
+ if (to == zero)
to = len;
}
@@ -2999,7 +2999,7 @@ val replace_vec(val vec_in, val items, val from, val to)
from = len;
else if (lt(from, zero)) {
from = plus(from, len);
- if (zerop(to))
+ if (to == zero)
to = len;
}