diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-07-27 06:46:04 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-07-27 06:46:04 -0700 |
commit | 50de41b73095374a330284f84f592bf56ad797b7 (patch) | |
tree | d63065e8a84a5da6c9e3a19a7a48281db915c3cd /txr.c | |
parent | 02bbca53efa5c2da8d671bd46e7e410ce533c846 (diff) | |
download | txr-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.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -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); |