diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-06-26 12:16:42 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-06-26 12:16:42 -0700 |
commit | 24c2898ff6d169b058d41ad68381d2036267ca0d (patch) | |
tree | 88ad198dcce80164ea18b7f849e77d1b7a1ca2a5 /stream.c | |
parent | bf2e5199e8dbc4e6fd4fcac5dab1ea16f4ec5970 (diff) | |
download | txr-24c2898ff6d169b058d41ad68381d2036267ca0d.tar.gz txr-24c2898ff6d169b058d41ad68381d2036267ca0d.tar.bz2 txr-24c2898ff6d169b058d41ad68381d2036267ca0d.zip |
base-name: bug with empty string suffix.
* stream.c (base_name): We must check for a zero length
suffix, otherwise sub(base, zero, neg(length(suff)))
produces an empty string.
* tests/018/path.tl: Test cases for base-name.
Diffstat (limited to 'stream.c')
-rw-r--r-- | stream.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -4990,7 +4990,7 @@ val base_name(val path, val suff) val base = mkustring(num_fast(end - rsep)); init_str(base, rsep, self); return if3(!null_or_missing_p(suff) && ends_with(suff, base, nil, nil) && - neql(length(suff), length(base)), + plusp(length(suff)) && neql(length(suff), length(base)), sub(base, zero, neg(length(suff))), base); } |