1 parent 8204db6 commit fcff466Copy full SHA for fcff466
1 file changed
unix/main.c
@@ -269,7 +269,14 @@ void pre_process_options(int argc, char **argv) {
269
emit_opt = MP_EMIT_OPT_VIPER;
270
#if MICROPY_ENABLE_GC
271
} else if (strncmp(argv[a + 1], "heapsize=", sizeof("heapsize=") - 1) == 0) {
272
- heap_size = strtol(argv[a + 1] + sizeof("heapsize=") - 1, NULL, 0);
+ char *end;
273
+ heap_size = strtol(argv[a + 1] + sizeof("heapsize=") - 1, &end, 0);
274
+ // Don't bring unneeded libc dependencies like tolower()
275
+ if ((*end | 0x20) == 'k') {
276
+ heap_size *= 1024;
277
+ } else if ((*end | 0x20) == 'm') {
278
+ heap_size *= 1024 * 1024;
279
+ }
280
#endif
281
} else {
282
exit(usage(argv));
0 commit comments