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:
e4de8c6
)
nmeter: code shrink
author
Denys Vlasenko
<vda.linux@googlemail.com>
Tue, 15 Mar 2016 14:28:49 +0000
(15:28 +0100)
committer
Denys Vlasenko
<vda.linux@googlemail.com>
Tue, 15 Mar 2016 14:28:49 +0000
(15:28 +0100)
function old new delta
put 52 43 -9
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
procps/nmeter.c
patch
|
blob
|
history
diff --git
a/procps/nmeter.c
b/procps/nmeter.c
index 0ce6842e704c16c88ce5d247a23276e8fc852a8c..8fe39c43b27ed716e5b6f1a1787ccd2f74955e34 100644
(file)
--- a/
procps/nmeter.c
+++ b/
procps/nmeter.c
@@
-142,11
+142,11
@@
static void print_outbuf(void)
static void put(const char *s)
{
-
int sz = strlen(s)
;
- i
f (sz > outbuf + sizeof(outbuf) - cur_outbuf)
- sz = outbuf + sizeof(outbuf) - cur_outbuf;
-
memcpy(cur_outbuf, s, sz)
;
- cur_outbuf
+= sz
;
+
char *p = cur_outbuf
;
+ i
nt sz = outbuf + sizeof(outbuf) - p;
+ while (*s && --sz >= 0)
+
*p++ = *s++
;
+ cur_outbuf
= p
;
}
static void put_c(char c)