Skip to content

Commit 2a4e4a0

Browse files
committed
fixed -D regression
1 parent bd63e60 commit 2a4e4a0

File tree

5 files changed

+6
-13
lines changed

5 files changed

+6
-13
lines changed

src/consolew.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,10 +444,8 @@ static inline int start_protective_mode_require(const char* file) {
444444

445445
// parses globals dynamic array and sets up global variables properly
446446
static inline void load_globals(Array* globals, void* data) {
447-
char* str = (char*) data + 2; // gather argument, ignore -D/-d
448-
449447
// split argument between '=', max is two (left and right)
450-
char* m_args = strsplit(str, '=', strlen(str) + 1, 2);
448+
char* m_args = strsplit((char*) data, '=', strlen((char*) data) + 1, 2);
451449
check_error(m_args == NULL, _("GLOBALS_ERROR_BAD_D"));
452450

453451
char* arg1 = m_args; // left arg of '='

src/jitsupport.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,12 @@
176176
for(size_t i=0; i<luajit_jcmds->size; i++)
177177
if(dojitcmd(L, (const char*) array_get(luajit_jcmds, i)) != 0)
178178
fputs(_("JS_FAILED_CONTROL_CMD"), stderr);
179-
array_free(luajit_jcmds);
180179
}
181180

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

189187
if(squelch == 0 && post_exist == 1)

src/ldata.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,8 @@ LC_LD_API int luacon_loaddll(LC_ARGS _ARGS, LangCache* _lang)
265265

266266

267267
// initiate global variables set up
268-
if(ARGS.globals != NULL) {
268+
if(ARGS.globals != NULL)
269269
array_consume(ARGS.globals, load_globals);
270-
array_free(ARGS.globals);
271-
}
272270

273271

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

309307

310308
// do passed libraries/modules
311-
if(ARGS.libraries != NULL) {
309+
if(ARGS.libraries != NULL)
312310
array_consume(ARGS.libraries, load_libraries);
313-
array_free(ARGS.libraries);
314-
}
315311

316312

317313
// run executable string after -l's

src/luadriver.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ int main(int argc, char** argv) {
223223
ARGS.run_str = (argv[i][2] == 0 ? argv[i+1] : argv[i]+2);
224224
break;
225225
case 'c': case 'C':
226+
ARGS.post_exist = 0;
226227
ARGS.do_luac = 1;
227228
ARGS.luac_argc = argc - i;
228229
ARGS.luac_argv = &(argv[i]);

travis.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ pushd bin/Debug
7272
./luaw -w lua-5.1.5 -e "print('Everything went okay')"
7373

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

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

8181
echo "Test 8"

0 commit comments

Comments
 (0)