diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2010-03-07 13:50:23 +0200 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2010-03-07 13:50:23 +0200 |
commit | 00fc1211ae7b687ac912098f4479112059deccbd (patch) | |
tree | 716567530880e4ed2b48886d0cf08552d3164687 /src/xzdec | |
parent | Change the default of --enable-assume-ram from 32 to 128 MiB. (diff) | |
download | xz-00fc1211ae7b687ac912098f4479112059deccbd.tar.xz |
Consistently round up the memory usage limit in messages.
It still feels a bit wrong to round 1 byte to 1 MiB but
at least it is now done consistently so that the same
byte value is always rounded the same way to MiB.
Diffstat (limited to 'src/xzdec')
-rw-r--r-- | src/xzdec/xzdec.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/xzdec/xzdec.c b/src/xzdec/xzdec.c index 6ddf7d28..3b1ab0f1 100644 --- a/src/xzdec/xzdec.c +++ b/src/xzdec/xzdec.c @@ -66,6 +66,10 @@ my_errorf(const char *fmt, ...) static void lzma_attribute((noreturn)) help(void) { + // Round up to the next MiB and do it correctly also with UINT64_MAX. + const uint64_t mem_mib = (memlimit >> 20) + + ((memlimit & ((UINT32_C(1) << 20) - 1)) != 0); + printf( "Usage: %s [OPTION]... [FILE]...\n" "Uncompress files in the ." TOOL_FORMAT " format to the standard output.\n" @@ -85,8 +89,7 @@ help(void) "%" PRIu64 " MiB RAM.\n" "\n" "Report bugs to <" PACKAGE_BUGREPORT "> (in English or Finnish).\n" -PACKAGE_NAME " home page: <" PACKAGE_URL ">\n", - progname, memlimit / (1024 * 1024)); +PACKAGE_NAME " home page: <" PACKAGE_URL ">\n", progname, mem_mib); tuklib_exit(EXIT_SUCCESS, EXIT_FAILURE, display_errors); } |