diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-07-06 09:14:01 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-07-09 11:11:21 +0200 |
commit | 2b59bf51a0fcd98f4bd56b8c47ce50357cf65c9a (patch) | |
tree | a3734788e349fa3032290c6a850b3eecd44fb4c1 /src/import | |
parent | 6c1abe880781b1e8145c53d5e959cd55c53ee245 (diff) | |
download | systemd-2b59bf51a0fcd98f4bd56b8c47ce50357cf65c9a.tar.gz |
tree-wide: add FORMAT_BYTES()
Diffstat (limited to 'src/import')
-rw-r--r-- | src/import/import-fs.c | 7 | ||||
-rw-r--r-- | src/import/pull-job.c | 7 |
2 files changed, 4 insertions, 10 deletions
diff --git a/src/import/import-fs.c b/src/import/import-fs.c index a12ee77ef9..e8c3740879 100644 --- a/src/import/import-fs.c +++ b/src/import/import-fs.c @@ -62,11 +62,8 @@ static void progress_show(ProgressInfo *p) { if (p->size == 0) log_info("Copying tree, currently at '%s'...", p->path); - else { - char buffer[FORMAT_BYTES_MAX]; - - log_info("Copying tree, currently at '%s' (@%s)...", p->path, format_bytes(buffer, sizeof(buffer), p->size)); - } + else + log_info("Copying tree, currently at '%s' (@%s)...", p->path, FORMAT_BYTES(p->size)); } static int progress_path(const char *path, const struct stat *st, void *userdata) { diff --git a/src/import/pull-job.c b/src/import/pull-job.c index 7215a00648..cd32ecc188 100644 --- a/src/import/pull-job.c +++ b/src/import/pull-job.c @@ -501,15 +501,13 @@ static size_t pull_job_header_callback(void *contents, size_t size, size_t nmemb (void) safe_atou64(length, &j->content_length); if (j->content_length != UINT64_MAX) { - char bytes[FORMAT_BYTES_MAX]; - if (j->content_length > j->compressed_max) { log_error("Content too large."); r = -EFBIG; goto fail; } - log_info("Downloading %s for %s.", format_bytes(bytes, sizeof(bytes), j->content_length), j->url); + log_info("Downloading %s for %s.", FORMAT_BYTES(j->content_length), j->url); } return sz; @@ -556,7 +554,6 @@ static int pull_job_progress_callback(void *userdata, curl_off_t dltotal, curl_o dlnow < dltotal) { if (n - j->start_usec > USEC_PER_SEC && dlnow > 0) { - char y[FORMAT_BYTES_MAX]; usec_t left, done; done = n - j->start_usec; @@ -566,7 +563,7 @@ static int pull_job_progress_callback(void *userdata, curl_off_t dltotal, curl_o percent, j->url, FORMAT_TIMESPAN(left, USEC_PER_SEC), - format_bytes(y, sizeof(y), (uint64_t) ((double) dlnow / ((double) done / (double) USEC_PER_SEC)))); + FORMAT_BYTES((uint64_t) ((double) dlnow / ((double) done / (double) USEC_PER_SEC)))); } else log_info("Got %u%% of %s.", percent, j->url); |