Skip to content
Snippets Groups Projects
Commit 0e5e14fe authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

unix/main: Error out on unknown value of suffix in -X heapsize= option.

E.g. -X heapsize=16Kfoo, -X heapsize=1G will lead to error.
parent a4c8a1ff
Branches
No related tags found
No related merge requests found
...@@ -351,12 +351,20 @@ STATIC void pre_process_options(int argc, char **argv) { ...@@ -351,12 +351,20 @@ STATIC void pre_process_options(int argc, char **argv) {
heap_size *= 1024; heap_size *= 1024;
} else if ((*end | 0x20) == 'm') { } else if ((*end | 0x20) == 'm') {
heap_size *= 1024 * 1024; heap_size *= 1024 * 1024;
} else {
// Compensate for ++ below
--end;
}
if (*++end != 0) {
goto invalid_arg;
} }
if (word_adjust) { if (word_adjust) {
heap_size = heap_size * BYTES_PER_WORD / 4; heap_size = heap_size * BYTES_PER_WORD / 4;
} }
#endif #endif
} else { } else {
invalid_arg:
printf("Invalid option\n");
exit(usage(argv)); exit(usage(argv));
} }
a++; a++;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment