diff options
Diffstat (limited to 'src/luajit.c')
-rw-r--r-- | src/luajit.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/luajit.c b/src/luajit.c index 35496339..680984da 100644 --- a/src/luajit.c +++ b/src/luajit.c | |||
@@ -498,15 +498,15 @@ static int handle_luainit(lua_State *L) | |||
498 | return dostring(L, init, "=" LUA_INIT); | 498 | return dostring(L, init, "=" LUA_INIT); |
499 | } | 499 | } |
500 | 500 | ||
501 | struct Smain { | 501 | static struct Smain { |
502 | char **argv; | 502 | char **argv; |
503 | int argc; | 503 | int argc; |
504 | int status; | 504 | int status; |
505 | }; | 505 | } smain; |
506 | 506 | ||
507 | static int pmain(lua_State *L) | 507 | static int pmain(lua_State *L) |
508 | { | 508 | { |
509 | struct Smain *s = (struct Smain *)lua_touserdata(L, 1); | 509 | struct Smain *s = &smain; |
510 | char **argv = s->argv; | 510 | char **argv = s->argv; |
511 | int script; | 511 | int script; |
512 | int flags = 0; | 512 | int flags = 0; |
@@ -555,17 +555,16 @@ static int pmain(lua_State *L) | |||
555 | int main(int argc, char **argv) | 555 | int main(int argc, char **argv) |
556 | { | 556 | { |
557 | int status; | 557 | int status; |
558 | struct Smain s; | ||
559 | lua_State *L = lua_open(); /* create state */ | 558 | lua_State *L = lua_open(); /* create state */ |
560 | if (L == NULL) { | 559 | if (L == NULL) { |
561 | l_message(argv[0], "cannot create state: not enough memory"); | 560 | l_message(argv[0], "cannot create state: not enough memory"); |
562 | return EXIT_FAILURE; | 561 | return EXIT_FAILURE; |
563 | } | 562 | } |
564 | s.argc = argc; | 563 | smain.argc = argc; |
565 | s.argv = argv; | 564 | smain.argv = argv; |
566 | status = lua_cpcall(L, pmain, &s); | 565 | status = lua_cpcall(L, pmain, NULL); |
567 | report(L, status); | 566 | report(L, status); |
568 | lua_close(L); | 567 | lua_close(L); |
569 | return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS; | 568 | return (status || smain.status) ? EXIT_FAILURE : EXIT_SUCCESS; |
570 | } | 569 | } |
571 | 570 | ||