diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2013-08-20 12:40:29 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-08-20 12:40:29 +0200 |
commit | f3114a3bd0d468a417e9e4a254d76ecf1cf35178 (patch) | |
tree | 3ccb4e035b7f5c3b33f4511b6480f13510a352b0 | |
parent | 90e9cfd2183a6ba547eb0e74081e175e8a2da75f (diff) | |
download | busybox-w32-f3114a3bd0d468a417e9e4a254d76ecf1cf35178.tar.gz busybox-w32-f3114a3bd0d468a417e9e4a254d76ecf1cf35178.tar.bz2 busybox-w32-f3114a3bd0d468a417e9e4a254d76ecf1cf35178.zip |
dd: code shrink
function old new delta
write_and_stats 78 99 +21
dd_main 1496 1487 -9
full_write_or_warn 42 - -42
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/1 up/down: 21/-51) Total: -30 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | coreutils/dd.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c index 53c3bdc81..e046ff5cc 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
@@ -440,8 +440,10 @@ int dd_main(int argc UNUSED_PARAM, char **argv) | |||
440 | oc = 0; | 440 | oc = 0; |
441 | } | 441 | } |
442 | } | 442 | } |
443 | } else if (write_and_stats(ibuf, n, obs, outfile)) | 443 | } else { |
444 | goto out_status; | 444 | if (write_and_stats(ibuf, n, obs, outfile)) |
445 | goto out_status; | ||
446 | } | ||
445 | 447 | ||
446 | if (flags & FLAG_FSYNC) { | 448 | if (flags & FLAG_FSYNC) { |
447 | if (fsync(ofd) < 0) | 449 | if (fsync(ofd) < 0) |
@@ -450,9 +452,8 @@ int dd_main(int argc UNUSED_PARAM, char **argv) | |||
450 | } | 452 | } |
451 | 453 | ||
452 | if (ENABLE_FEATURE_DD_IBS_OBS && oc) { | 454 | if (ENABLE_FEATURE_DD_IBS_OBS && oc) { |
453 | ssize_t w = full_write_or_warn(obuf, oc, outfile); | 455 | if (write_and_stats(obuf, oc, obs, outfile)) |
454 | if (w < 0) goto out_status; | 456 | goto out_status; |
455 | if (w > 0) G.out_part++; | ||
456 | } | 457 | } |
457 | if (close(ifd) < 0) { | 458 | if (close(ifd) < 0) { |
458 | die_infile: | 459 | die_infile: |