summaryrefslogtreecommitdiffstats
path: root/txr.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-07-27 06:46:04 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-07-27 06:46:04 -0700
commit50de41b73095374a330284f84f592bf56ad797b7 (patch)
treed63065e8a84a5da6c9e3a19a7a48281db915c3cd /txr.c
parent02bbca53efa5c2da8d671bd46e7e410ce533c846 (diff)
downloadtxr-50de41b73095374a330284f84f592bf56ad797b7.tar.gz
txr-50de41b73095374a330284f84f592bf56ad797b7.tar.bz2
txr-50de41b73095374a330284f84f592bf56ad797b7.zip
Take advantage of substring support in regsub.
* txr.c (sysroot_init): Use regsub to look for "\\" substring instead of regex. * stdlib/getopts.tl (opt-parsed convert-type): regsub for "0x" substring rather than #/0x/ regex. * stdlib/pic.tl (pic-join-oipt): regsub for "~" substring rather than #/\~/ regex. * stdlib/socket.tl (in6addr-str): regsub for "::" substring instead of #/::/ regex in two places. The double regsub there looks like a mistake; will address in another commit.
Diffstat (limited to 'txr.c')
-rw-r--r--txr.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/txr.c b/txr.c
index 8fab8eae..35f34212 100644
--- a/txr.c
+++ b/txr.c
@@ -321,13 +321,10 @@ static void sysroot_init(void)
const wchar_t *psc = coerce(const wchar_t *, path_sep_chars);
int share_txr_stdlib = 1;
-#if HAVE_WINDOWS_H
- val slash = regex_compile(lit("\\\\"), nil);
-#endif
protect(&prog_path, &sysroot_path, &stdlib_path, convert(val *, 0));
prog_path = get_self_path();
#if HAVE_WINDOWS_H
- prog_path = regsub(slash, lit("/"), prog_path);
+ prog_path = regsub(lit("\\"), lit("/"), prog_path);
#endif
prog_dir = dir_name(prog_path);