summaryrefslogtreecommitdiffstats
path: root/lib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2020-10-16 06:36:41 -0700
committerKaz Kylheku <kaz@kylheku.com>2020-10-16 06:36:41 -0700
commitde8bd6233c62718c592694a2b8463e329567d85f (patch)
tree5423d47105d75a96946677a1086c2eb6d412df7f /lib.c
parentcd22aba61b64883e6026cd1fc31cc2f5a426f314 (diff)
downloadtxr-de8bd6233c62718c592694a2b8463e329567d85f.tar.gz
txr-de8bd6233c62718c592694a2b8463e329567d85f.tar.bz2
txr-de8bd6233c62718c592694a2b8463e329567d85f.zip
env: move function to sysif.c
* lib.c (env_list): Static variable removed; now appears in sysif.c (env): Function removed; now in sysif.c. (obj_init): Don't gc-protect env_list here any more. * lib.h (env): Declaration removed. * match.c: Must include "sysif.h" now for env. * sysif.c (env_list): Static variable moved here. (env): Function moved here. (sysif_init): env_list gc-protected here. * sysif.h (env): Declared.
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c36
1 files changed, 1 insertions, 35 deletions
diff --git a/lib.c b/lib.c
index 6e46039f..2d38cd78 100644
--- a/lib.c
+++ b/lib.c
@@ -130,7 +130,6 @@ val list_f, less_f, greater_f;
val prog_string;
-static val env_list;
static val recycled_conses;
const seq_kind_t seq_kind_tab[MAXTYPE+1] = {
@@ -11867,39 +11866,6 @@ val in_range_star(val range, val num)
}
}
-val env(void)
-{
- if (env_list) {
- return env_list;
- } else {
- list_collect_decl (out, ptail);
-#if HAVE_ENVIRON
- extern char **environ;
- char **iter = environ;
-
- for (; *iter != 0; iter++)
- ptail = list_collect(ptail, string_utf8(*iter));
-
- return env_list = out;
-#elif HAVE_GETENVIRONMENTSTRINGS
- wchar_t *env = GetEnvironmentStringsW();
- wchar_t *iter = env;
-
- if (iter == 0)
- oom();
-
- for (; *iter; iter += wcslen(iter) + 1)
- ptail = list_collect(ptail, string(iter));
-
- FreeEnvironmentStringsW(env);
-
- return env_list = out;
-#else
- uw_throwf(error_s, lit("environment strings not available"), nao);
-#endif
- }
-}
-
static void obj_init(void)
{
val self = lit("internal init");
@@ -11915,7 +11881,7 @@ static void obj_init(void)
&null_list, &equal_f, &eq_f, &eql_f,
&car_f, &cdr_f, &null_f, &list_f,
&identity_f, &identity_star_f, &less_f, &greater_f,
- &prog_string, &env_list,
+ &prog_string,
convert(val *, 0));
nil_string = lit("nil");