projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1b57fe1
)
dd: code shrink
author
Denys Vlasenko
<vda.linux@googlemail.com>
Tue, 20 Aug 2013 10:49:28 +0000
(12:49 +0200)
committer
Denys Vlasenko
<vda.linux@googlemail.com>
Tue, 20 Aug 2013 10:49:28 +0000
(12:49 +0200)
function old new delta
dd_main 1475 1469 -6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
coreutils/dd.c
patch
|
blob
|
history
diff --git
a/coreutils/dd.c
b/coreutils/dd.c
index 9299f58bcb197a38ba6a96e1088a892f43268757..2838f63415df3571bd37dbcdd7e859f274345342 100644
(file)
--- a/
coreutils/dd.c
+++ b/
coreutils/dd.c
@@
-395,7
+395,8
@@
int dd_main(int argc UNUSED_PARAM, char **argv)
n = 0;
}
if (flags & FLAG_SWAB) {
- uint16_t *p16, *end;
+ uint16_t *p16;
+ ssize_t n2;
/* Our code allows only last read to be odd-sized */
if (prev_read_size & 1)
@@
-408,8
+409,8
@@
int dd_main(int argc UNUSED_PARAM, char **argv)
* prints "wqe".
*/
p16 = (void*) ibuf;
-
end = (void*) (ibuf + (n & ~(ssize_t)1)
);
- while (
p16 < end
) {
+
n2 = (n >> 1
);
+ while (
--n2 >= 0
) {
*p16 = bswap_16(*p16);
p16++;
}