nmeter: code shrink
function old new delta put 52 43 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
e4de8c6316
commit
99c71c9e80
@ -142,11 +142,11 @@ static void print_outbuf(void)
|
|||||||
|
|
||||||
static void put(const char *s)
|
static void put(const char *s)
|
||||||
{
|
{
|
||||||
int sz = strlen(s);
|
char *p = cur_outbuf;
|
||||||
if (sz > outbuf + sizeof(outbuf) - cur_outbuf)
|
int sz = outbuf + sizeof(outbuf) - p;
|
||||||
sz = outbuf + sizeof(outbuf) - cur_outbuf;
|
while (*s && --sz >= 0)
|
||||||
memcpy(cur_outbuf, s, sz);
|
*p++ = *s++;
|
||||||
cur_outbuf += sz;
|
cur_outbuf = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void put_c(char c)
|
static void put_c(char c)
|
||||||
|
Loading…
Reference in New Issue
Block a user