diff options
author | Ron Yorston <rmy@pobox.com> | 2024-04-09 09:09:28 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-04-09 09:09:28 +0100 |
commit | e1f73b64dcf047c9794f3546e3dc1b041a3660a6 (patch) | |
tree | 1c814735b6bb33bf699d9311c4b8560bbe5c81bc | |
parent | fcf3ec2877f042c6957d808e562807089e23ebe6 (diff) | |
download | busybox-w32-e1f73b64dcf047c9794f3546e3dc1b041a3660a6.tar.gz busybox-w32-e1f73b64dcf047c9794f3546e3dc1b041a3660a6.tar.bz2 busybox-w32-e1f73b64dcf047c9794f3546e3dc1b041a3660a6.zip |
time: code shrink
Commit 54dbf0fa5 (time: mitigation for interleaved output) added
buffering to stderr in the 'time' applet.
@avih pointed out that it isn't necessary to provide an explicit
buffer.
Saves 16 bytes in the 64-bit build.
(GitHub issue #396)
-rw-r--r-- | miscutils/time.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/miscutils/time.c b/miscutils/time.c index 09a474979..9a1039be9 100644 --- a/miscutils/time.c +++ b/miscutils/time.c | |||
@@ -471,9 +471,6 @@ int time_main(int argc UNUSED_PARAM, char **argv) | |||
471 | /* $TIME has lowest prio (-v,-p,-f FMT override it) */ | 471 | /* $TIME has lowest prio (-v,-p,-f FMT override it) */ |
472 | const char *output_format = getenv("TIME") ? : default_format; | 472 | const char *output_format = getenv("TIME") ? : default_format; |
473 | char *output_filename; | 473 | char *output_filename; |
474 | #if ENABLE_PLATFORM_MINGW32 | ||
475 | char buffer[256]; | ||
476 | #endif | ||
477 | int output_fd; | 474 | int output_fd; |
478 | int opt; | 475 | int opt; |
479 | int ex; | 476 | int ex; |
@@ -528,7 +525,7 @@ int time_main(int argc UNUSED_PARAM, char **argv) | |||
528 | /* Cheat. printf's are shorter :) */ | 525 | /* Cheat. printf's are shorter :) */ |
529 | xdup2(output_fd, STDOUT_FILENO); | 526 | xdup2(output_fd, STDOUT_FILENO); |
530 | #if ENABLE_PLATFORM_MINGW32 | 527 | #if ENABLE_PLATFORM_MINGW32 |
531 | setvbuf(stdout, buffer, _IOFBF, sizeof(buffer)); | 528 | setvbuf(stdout, NULL, _IOFBF, 256); |
532 | #endif | 529 | #endif |
533 | summarize(output_format, argv, &res); | 530 | summarize(output_format, argv, &res); |
534 | 531 | ||