Created
September 16, 2018 10:20
-
-
Save holmeshe/562423c9a816b47fedbf65aa363e8521 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case 'I': | |
buf = strdup(optarg); | |
unit = buf[strlen(buf)-1]; | |
if (unit == 'k' || unit == 'm' || | |
unit == 'K' || unit == 'M') { | |
buf[strlen(buf)-1] = '\0'; | |
size_max = atoi(buf); | |
if (unit == 'k' || unit == 'K') | |
size_max *= 1024; | |
if (unit == 'm' || unit == 'M') | |
size_max *= 1024 * 1024; | |
settings.item_size_max = size_max; | |
} else { | |
settings.item_size_max = atoi(buf); | |
} | |
free(buf); | |
if (settings.item_size_max < 1024) { | |
fprintf(stderr, "Item max size cannot be less than 1024 bytes.\n"); | |
return 1; | |
} | |
if (settings.item_size_max > 1024 * 1024 * 128) { | |
fprintf(stderr, "Cannot set item size limit higher than 128 mb.\n"); | |
return 1; | |
} | |
if (settings.item_size_max > 1024 * 1024) { | |
fprintf(stderr, "WARNING: Setting item max size above 1MB is not" | |
" recommended!\n" | |
" Raising this limit increases the minimum memory requirements\n" | |
" and will decrease your memory efficiency.\n" | |
); | |
} | |
break; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment