summaryrefslogtreecommitdiffhomepage
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/main.c b/main.c
index 3fd1f25..10db64a 100644
--- a/main.c
+++ b/main.c
@@ -57,26 +57,20 @@ print_usage(const char *app)
static void
globals_init(uc_vm *vm, uc_value_t *scope, int argc, char **argv)
{
- uc_value_t *arr = ucv_array_new(vm);
- const char *p, *last;
- int i;
+ const char *path[] = { LIB_SEARCH_PATH };
+ uc_value_t *arr;
+ size_t i;
- for (p = last = LIB_SEARCH_PATH;; p++) {
- if (*p == ':' || *p == '\0') {
- ucv_array_push(arr, ucv_string_new_length(last, p - last));
-
- if (!*p)
- break;
+ arr = ucv_array_new(vm);
- last = p + 1;
- }
- }
+ for (i = 0; i < sizeof(path) / sizeof(path[0]); i++)
+ ucv_array_push(arr, ucv_string_new(path[i]));
ucv_object_add(scope, "REQUIRE_SEARCH_PATH", arr);
arr = ucv_array_new(vm);
- for (i = 0; i < argc; i++)
+ for (i = 0; i < (size_t)argc; i++)
ucv_array_push(arr, ucv_string_new(argv[i]));
ucv_object_add(scope, "ARGV", arr);