← Commit list

99c71c9e8

Denys Vlasenko
Denys Vlasenko
2016-03-15
SUCCESS Duration: 269s

Subject

nmeter: code shrink

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

procps/nmeter.c+5 -5
@@ -142,11 +142,11 @@ static void print_outbuf(void)
static void put(const char *s)
{
- int sz = strlen(s);
- if (sz > outbuf + sizeof(outbuf) - cur_outbuf)
- sz = outbuf + sizeof(outbuf) - cur_outbuf;
- memcpy(cur_outbuf, s, sz);
- cur_outbuf += sz;
+ char *p = cur_outbuf;
+ int sz = outbuf + sizeof(outbuf) - p;
+ while (*s && --sz >= 0)
+ *p++ = *s++;
+ cur_outbuf = p;
}
static void put_c(char c)