OSDN Git Service

utils: provide size_to_str()
authorPeter Xu <peterx@redhat.com>
Fri, 12 May 2017 04:17:40 +0000 (12:17 +0800)
committerDr. David Alan Gilbert <dgilbert@redhat.com>
Wed, 17 May 2017 16:30:45 +0000 (17:30 +0100)
commit22951aaaebb6c4c314c58ad576960a9c57695bbc
treef1071715f4dbec35fdeca1703eaf6fb5815ebb74
parent99e15582dea30d4a7c6fa5be9196d0f4d759231c
utils: provide size_to_str()

Moving the algorithm from print_type_size() into size_to_str() so that
other component can also leverage it. With that, refactor
print_type_size().

The assert() in that logic is removed though, since even UINT64_MAX
would not overflow.

Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <1494562661-9063-3-git-send-email-peterx@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
include/qemu-common.h
qapi/string-output-visitor.c
util/cutils.c