diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2013-08-20 12:49:28 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2013-08-20 12:49:28 +0200 |
| commit | 0ff0b320a2dbb5e0b5fa245ffd9b2648d7026843 (patch) | |
| tree | 5cab931e8ad6fdaa8a6b0e3d5344f6c9d8f039f1 | |
| parent | 1b57fe108f082167fd85a5962769a941ba871dd4 (diff) | |
| download | busybox-w32-0ff0b320a2dbb5e0b5fa245ffd9b2648d7026843.tar.gz busybox-w32-0ff0b320a2dbb5e0b5fa245ffd9b2648d7026843.tar.bz2 busybox-w32-0ff0b320a2dbb5e0b5fa245ffd9b2648d7026843.zip | |
dd: code shrink
function old new delta
dd_main 1475 1469 -6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | coreutils/dd.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/coreutils/dd.c b/coreutils/dd.c index 9299f58bc..2838f6341 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
| @@ -395,7 +395,8 @@ int dd_main(int argc UNUSED_PARAM, char **argv) | |||
| 395 | n = 0; | 395 | n = 0; |
| 396 | } | 396 | } |
| 397 | if (flags & FLAG_SWAB) { | 397 | if (flags & FLAG_SWAB) { |
| 398 | uint16_t *p16, *end; | 398 | uint16_t *p16; |
| 399 | ssize_t n2; | ||
| 399 | 400 | ||
| 400 | /* Our code allows only last read to be odd-sized */ | 401 | /* Our code allows only last read to be odd-sized */ |
| 401 | if (prev_read_size & 1) | 402 | if (prev_read_size & 1) |
| @@ -408,8 +409,8 @@ int dd_main(int argc UNUSED_PARAM, char **argv) | |||
| 408 | * prints "wqe". | 409 | * prints "wqe". |
| 409 | */ | 410 | */ |
| 410 | p16 = (void*) ibuf; | 411 | p16 = (void*) ibuf; |
| 411 | end = (void*) (ibuf + (n & ~(ssize_t)1)); | 412 | n2 = (n >> 1); |
| 412 | while (p16 < end) { | 413 | while (--n2 >= 0) { |
| 413 | *p16 = bswap_16(*p16); | 414 | *p16 = bswap_16(*p16); |
| 414 | p16++; | 415 | p16++; |
| 415 | } | 416 | } |
