From 7f32abf75c25952d203c16ec134f7722940ff5e3 Mon Sep 17 00:00:00 2001 From: Akos Kiss Date: Tue, 9 May 2017 05:40:37 +0200 Subject: [PATCH] Remove limitation on number of command line arguments in jerry-main (#1806) Since JerryScript has been a C99 project for a while now, we can use variable-length arrays. This allows the removal of the artificial limit on command line arguments in jerry-main. JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu --- jerry-main/main-unix.c | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/jerry-main/main-unix.c b/jerry-main/main-unix.c index 6ac323b89..c22ba7f1d 100644 --- a/jerry-main/main-unix.c +++ b/jerry-main/main-unix.c @@ -22,11 +22,6 @@ #include "jerryscript-port.h" #include "jerryscript-port-default.h" -/** - * Maximum command line arguments number - */ -#define JERRY_MAX_COMMAND_LINE_ARGS (64) - /** * Maximum size of source code */ @@ -494,22 +489,12 @@ int main (int argc, char **argv) { - if (argc > JERRY_MAX_COMMAND_LINE_ARGS) - { - jerry_port_log (JERRY_LOG_LEVEL_ERROR, - "Error: too many command line arguments: %d (JERRY_MAX_COMMAND_LINE_ARGS=%d)\n", - argc, - JERRY_MAX_COMMAND_LINE_ARGS); - - return JERRY_STANDALONE_EXIT_CODE_FAIL; - } - - const char *file_names[JERRY_MAX_COMMAND_LINE_ARGS]; + const char *file_names[argc]; int files_counter = 0; jerry_init_flag_t flags = JERRY_INIT_EMPTY; - const char *exec_snapshot_file_names[JERRY_MAX_COMMAND_LINE_ARGS]; + const char *exec_snapshot_file_names[argc]; int exec_snapshots_count = 0; bool is_parse_only = false; @@ -598,7 +583,6 @@ main (int argc, if (check_feature (JERRY_FEATURE_SNAPSHOT_EXEC, argv[i++])) { - assert (exec_snapshots_count < JERRY_MAX_COMMAND_LINE_ARGS); exec_snapshot_file_names[exec_snapshots_count++] = argv[i]; } }