diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2012-02-27 14:37:48 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2012-02-27 14:37:48 +0100 |
commit | 1945ccc3fbd5b56008c4a6b0cdd4611616201675 (patch) | |
tree | cd3ccfbe31c8e9a2a795baf172c783a33270e381 /process.c | |
parent | 72879c6a35cd5afa7f58ee7bc32e4dcd8e65bd9a (diff) | |
download | strace-1945ccc3fbd5b56008c4a6b0cdd4611616201675.tar.gz strace-1945ccc3fbd5b56008c4a6b0cdd4611616201675.tar.bz2 strace-1945ccc3fbd5b56008c4a6b0cdd4611616201675.tar.xz |
Assorted trivial optimizations
text data bss dec hex filename
236448 672 19044 256164 3e8a4 strace.before
236360 672 19044 256076 3e84c strace
* file.c (sprintmode): Use smaller static buffer, eliminate strlen call.
(sprinttime): Use smaller static buffer.
(printstat_sparc64): Coalesce two printing calls into one.
(printstat_powerpc32): Likewise.
(printcompat_statfs6): Likewise.
(sys_utime): Do not fetch personality_wordsize[current_personality]
repeatedly - cache it in local variable instead.
* process.c (printargv): Likewise.
* resource.c (sprintrlim): Return const char*, not char*. This allows
to eliminate sprintf(buf, "RLIM_INFINITY"). Use smaller static buffer.
(sprintrlim64): Likewise.
* strace.c (strerror): Use smaller static buffer.
(strsignal): Likewise.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'process.c')
-rw-r--r-- | process.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -1007,21 +1007,21 @@ printargv(struct tcb *tcp, long addr) } cp; const char *sep; int n = 0; + unsigned wordsize = personality_wordsize[current_personality]; cp.p64 = 1; for (sep = ""; !abbrev(tcp) || n < max_strlen / 2; sep = ", ", ++n) { - if (umoven(tcp, addr, personality_wordsize[current_personality], - cp.data) < 0) { + if (umoven(tcp, addr, wordsize, cp.data) < 0) { tprintf("%#lx", addr); return; } - if (personality_wordsize[current_personality] == 4) + if (wordsize == 4) cp.p64 = cp.p32; if (cp.p64 == 0) break; tprints(sep); printstr(tcp, cp.p64, -1); - addr += personality_wordsize[current_personality]; + addr += wordsize; } if (cp.p64) tprintf("%s...", sep); |