From 3736361f915a7df8ed3ffc9a52b47e7af6bc280b Mon Sep 17 00:00:00 2001 From: Kaz Kylheku <kaz@kylheku.com> Date: Fri, 7 Aug 2020 22:48:19 -0700 Subject: cygwin: bugs in string catenation and splitting. This looks like it originates in June 19, 2019 commit 28c6225fec6ce999806e9c077f08ed0e668646c4, before Version 218. The commit introduced the ability to use a character object as a separator in cat_str and split_str_keep. The implementation was broken as written for Cygwin. This finally showed up for me today as a failure in the new in6addr-str test cases. By chance, I noticed at the same time that tab completion in the listener was acting strangely on packag prefix symbols; that issue also went away with this fix. * lib.c (cat_str, vscat, scat3, split_str_keep): We must use wref on the array initialized using the wini macro, because on Cygwin, the string starts at [1] not [0]. --- lib.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib.c b/lib.c index e2cf91fe..7e579f41 100644 --- a/lib.c +++ b/lib.c @@ -4810,7 +4810,7 @@ val cat_str(val list, val sep) struct cat_str cs; wchar_t onech[] = wini(" "); - cat_str_init(&cs, sep, onech, self); + cat_str_init(&cs, sep, wref(onech), self); for (iter = list; iter != nil; iter = cdr(iter)) cat_str_measure(&cs, car(iter), cdr(iter) != nil, self); @@ -4829,7 +4829,7 @@ static val vscat(val sep, va_list vl1, va_list vl2, val self) struct cat_str cs; wchar_t onech[] = wini(" "); - cat_str_init(&cs, sep, onech, self); + cat_str_init(&cs, sep, wref(onech), self); for (item = va_arg(vl1, val); item != nao; item = next) { @@ -4885,7 +4885,7 @@ val scat3(val s1, val sep, val s2) struct cat_str cs; wchar_t onech[] = wini(" "); - cat_str_init(&cs, sep, onech, self); + cat_str_init(&cs, sep, wref(onech), self); cat_str_measure(&cs, s1, 1, self); cat_str_measure(&cs, s2, 0, self); @@ -4961,7 +4961,7 @@ val split_str_keep(val str, val sep, val keep_sep) wchar_t onech[] = wini(" "); if (chrp(sep)) { - onech[0] = c_chr(sep); + wref(onech)[0] = c_chr(sep); len_sep = 1; sep = auto_str(coerce(const wchli_t *, wref(onech))); } else { -- cgit v1.2.3