1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-20 18:27:40 +00:00
Synchronize critical sections in setenv/getenv/environ.
This commit is contained in:
Calvin Rose
2020-01-06 19:30:44 -06:00
parent c4047f3f88
commit ed5027db5d
4 changed files with 67 additions and 10 deletions

View File

@@ -150,6 +150,13 @@ DEFINE_OPTLEN(buffer, BUFFER, JanetBuffer *)
DEFINE_OPTLEN(table, TABLE, JanetTable *)
DEFINE_OPTLEN(array, ARRAY, JanetArray *)
const char *janet_optcstring(const Janet *argv, int32_t argc, int32_t n, const char *dflt) {
if (n >= argc || janet_checktype(argv[n], JANET_NIL)) {
return dflt;
}
return janet_getcstring(argv, n);
}
#undef DEFINE_GETTER
#undef DEFINE_OPT
#undef DEFINE_OPTLEN