summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2025-05-30 01:10:33 -0700
committerKaz Kylheku <kaz@kylheku.com>2025-05-30 01:10:33 -0700
commitedfe34e241aafe19e6b29840e18ce318a2d22d61 (patch)
treec78e7d1af14b9b1ebd1332dfeda1d393b6373aa8
parentb01dcd8533183810adec7bd52edab4868a521436 (diff)
downloadtxr-edfe34e241aafe19e6b29840e18ce318a2d22d61.tar.gz
txr-edfe34e241aafe19e6b29840e18ce318a2d22d61.tar.bz2
txr-edfe34e241aafe19e6b29840e18ce318a2d22d61.zip
buf: bug in sub_buf.
* buf.c (sub_buf): Wrong comparison of from to 0 gets interpreted as a null pointer check (is from nil); we want zero at that point in the code.
-rw-r--r--buf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/buf.c b/buf.c
index d5782dc2..41de5b28 100644
--- a/buf.c
+++ b/buf.c
@@ -433,7 +433,7 @@ val sub_buf(val buf, val from, val to)
if (ge(from, to)) {
return make_buf(zero, nil, zero);
- } else if (from == 0 && to == len) {
+ } else if (from == zero && to == len) {
return buf;
} else {
return make_duplicate_buf(minus(to, from), b->data + c_num(from, self));