diff options
| author | Collin Funk <collin.funk1@gmail.com> | 2025-09-16 19:43:46 -0700 |
|---|---|---|
| committer | Collin Funk <collin.funk1@gmail.com> | 2025-09-16 19:43:46 -0700 |
| commit | 1efb539630d6fd45e2c92f094471d3760f5b6836 (patch) | |
| tree | a3c8005310d14c7261953618dd8c5ae19a21a1bb | |
| parent | doc: add hardware acceleration configuration docs (diff) | |
| download | coreutils-1efb539630d6fd45e2c92f094471d3760f5b6836.tar.gz coreutils-1efb539630d6fd45e2c92f094471d3760f5b6836.zip | |
maint: remove unnecessary uintmaxtostr usage in printf
* src/comm.c (compare_files): Use the "%ju" printf directive instead of
"%s" and printing the result of umaxtostr.
* src/df.c (get_header): Likewise.
* src/ls.c (print_long_format): Likewise.
* src/sort.c (check): Likewise.
| -rw-r--r-- | src/comm.c | 19 | ||||
| -rw-r--r-- | src/df.c | 5 | ||||
| -rw-r--r-- | src/ls.c | 8 | ||||
| -rw-r--r-- | src/sort.c | 6 |
4 files changed, 14 insertions, 24 deletions
diff --git a/src/comm.c b/src/comm.c index dd61dd9c8..6ebf66f38 100644 --- a/src/comm.c +++ b/src/comm.c @@ -388,23 +388,20 @@ compare_files (char **infiles) if (total_option) { /* Print the summary, minding the column and line delimiters. */ - char buf1[INT_BUFSIZE_BOUND (uintmax_t)]; - char buf2[INT_BUFSIZE_BOUND (uintmax_t)]; - char buf3[INT_BUFSIZE_BOUND (uintmax_t)]; if (col_sep_len == 1) { /* Separate to handle NUL char. */ - printf ("%s%c%s%c%s%c%s%c", - umaxtostr (total[0], buf1), *col_sep, - umaxtostr (total[1], buf2), *col_sep, - umaxtostr (total[2], buf3), *col_sep, + printf ("%ju%c%ju%c%ju%c%s%c", + total[0], *col_sep, + total[1], *col_sep, + total[2], *col_sep, _("total"), delim); } else { - printf ("%s%s%s%s%s%s%s%c", - umaxtostr (total[0], buf1), col_sep, - umaxtostr (total[1], buf2), col_sep, - umaxtostr (total[2], buf3), col_sep, + printf ("%ju%s%ju%s%ju%s%s%c", + total[0], col_sep, + total[1], col_sep, + total[2], col_sep, _("total"), delim); } } @@ -617,11 +617,8 @@ get_header (void) } else if (header_mode == POSIX_MODE && columns[col]->field == SIZE_FIELD) { - char buf[INT_BUFSIZE_BOUND (uintmax_t)]; - char *num = umaxtostr (output_block_size, buf); - /* TRANSLATORS: this is the "1024-blocks" header in "df -P". */ - cell = xasprintf (_("%s-%s"), num, header); + cell = xasprintf (_("%ju-%s"), output_block_size, header); } else cell = xstrdup (header); @@ -4397,16 +4397,14 @@ print_long_format (const struct fileinfo *f) if (f->stat_ok && (S_ISCHR (f->stat.st_mode) || S_ISBLK (f->stat.st_mode))) { - char majorbuf[INT_BUFSIZE_BOUND (uintmax_t)]; - char minorbuf[INT_BUFSIZE_BOUND (uintmax_t)]; int blanks_width = (file_size_width - (major_device_number_width + 2 + minor_device_number_width)); - p += sprintf (p, "%*s, %*s ", + p += sprintf (p, "%*ju, %*ju ", major_device_number_width + MAX (0, blanks_width), - umaxtostr (major (f->stat.st_rdev), majorbuf), + (uintmax_t) major (f->stat.st_rdev), minor_device_number_width, - umaxtostr (minor (f->stat.st_rdev), minorbuf)); + (uintmax_t) minor (f->stat.st_rdev)); } else { diff --git a/src/sort.c b/src/sort.c index 8363d2d1d..a4d81bc1c 100644 --- a/src/sort.c +++ b/src/sort.c @@ -2997,10 +2997,8 @@ check (char const *file_name, char checkonly) struct line const *disorder_line = line - 1; uintmax_t disorder_line_number = buffer_linelim (&buf) - disorder_line + line_number; - char hr_buf[INT_BUFSIZE_BOUND (disorder_line_number)]; - fprintf (stderr, _("%s: %s:%s: disorder: "), - program_name, file_name, - umaxtostr (disorder_line_number, hr_buf)); + fprintf (stderr, _("%s: %s:%ju: disorder: "), + program_name, file_name, disorder_line_number); write_line (disorder_line, stderr, _("standard error")); } |
