Skip to content
Snippets Groups Projects
Commit fcff4663 authored by Paul Sokolovsky's avatar Paul Sokolovsky Committed by Damien George
Browse files

unix: Allow -X heapsize= option take numbers with K & M suffixes.

For kilobytes and megabytes respectively.
parent 8204db68
No related branches found
No related tags found
No related merge requests found
...@@ -269,7 +269,14 @@ void pre_process_options(int argc, char **argv) { ...@@ -269,7 +269,14 @@ void pre_process_options(int argc, char **argv) {
emit_opt = MP_EMIT_OPT_VIPER; emit_opt = MP_EMIT_OPT_VIPER;
#if MICROPY_ENABLE_GC #if MICROPY_ENABLE_GC
} else if (strncmp(argv[a + 1], "heapsize=", sizeof("heapsize=") - 1) == 0) { } else if (strncmp(argv[a + 1], "heapsize=", sizeof("heapsize=") - 1) == 0) {
heap_size = strtol(argv[a + 1] + sizeof("heapsize=") - 1, NULL, 0); char *end;
heap_size = strtol(argv[a + 1] + sizeof("heapsize=") - 1, &end, 0);
// Don't bring unneeded libc dependencies like tolower()
if ((*end | 0x20) == 'k') {
heap_size *= 1024;
} else if ((*end | 0x20) == 'm') {
heap_size *= 1024 * 1024;
}
#endif #endif
} else { } else {
exit(usage(argv)); exit(usage(argv));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment