Skip to content

Commit

Permalink
fixed -D regression
Browse files Browse the repository at this point in the history
  • Loading branch information
tilkinsc committed Jan 24, 2019
1 parent bd63e60 commit 2a4e4a0
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 13 deletions.
4 changes: 1 addition & 3 deletions src/consolew.h
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,8 @@ static inline int start_protective_mode_require(const char* file) {

// parses globals dynamic array and sets up global variables properly
static inline void load_globals(Array* globals, void* data) {
char* str = (char*) data + 2; // gather argument, ignore -D/-d

// split argument between '=', max is two (left and right)
char* m_args = strsplit(str, '=', strlen(str) + 1, 2);
char* m_args = strsplit((char*) data, '=', strlen((char*) data) + 1, 2);
check_error(m_args == NULL, _("GLOBALS_ERROR_BAD_D"));

char* arg1 = m_args; // left arg of '='
Expand Down
2 changes: 0 additions & 2 deletions src/jitsupport.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,12 @@
for(size_t i=0; i<luajit_jcmds->size; i++)
if(dojitcmd(L, (const char*) array_get(luajit_jcmds, i)) != 0)
fputs(_("JS_FAILED_CONTROL_CMD"), stderr);
array_free(luajit_jcmds);
}

if(luajit_opts != NULL) {
for(size_t i=0; i<luajit_opts->size; i++)
if(dojitopt(L, (const char*) array_get(luajit_opts, i)) != 0)
fputs(_("JS_FAILED_SET_O"), stderr);
array_free(luajit_opts);
}

if(squelch == 0 && post_exist == 1)
Expand Down
8 changes: 2 additions & 6 deletions src/ldata.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,8 @@ LC_LD_API int luacon_loaddll(LC_ARGS _ARGS, LangCache* _lang)


// initiate global variables set up
if(ARGS.globals != NULL) {
if(ARGS.globals != NULL)
array_consume(ARGS.globals, load_globals);
array_free(ARGS.globals);
}


// load parameters early
Expand Down Expand Up @@ -308,10 +306,8 @@ LC_LD_API int luacon_loaddll(LC_ARGS _ARGS, LangCache* _lang)


// do passed libraries/modules
if(ARGS.libraries != NULL) {
if(ARGS.libraries != NULL)
array_consume(ARGS.libraries, load_libraries);
array_free(ARGS.libraries);
}


// run executable string after -l's
Expand Down
1 change: 1 addition & 0 deletions src/luadriver.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ int main(int argc, char** argv) {
ARGS.run_str = (argv[i][2] == 0 ? argv[i+1] : argv[i]+2);
break;
case 'c': case 'C':
ARGS.post_exist = 0;
ARGS.do_luac = 1;
ARGS.luac_argc = argc - i;
ARGS.luac_argv = &(argv[i]);
Expand Down
4 changes: 2 additions & 2 deletions travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ pushd bin/Debug
./luaw -w lua-5.1.5 -e "print('Everything went okay')"

echo "Test 6"
./luaw "res/testing.lua" -Dtest=5 -n a b c
./luaw res/testing.lua -Dtest=5 -n a b c

echo "Test 7"
./luaw -c -o testing.luac "res/testing.lua"
./luaw -b res/testing.lua testing.luac
./luaw testing.luac -Dtest=5 -n a b c

echo "Test 8"
Expand Down

0 comments on commit 2a4e4a0

Please sign in to comment.