]> granicus.if.org Git - strace/commit
Open-code isprint(c) and isspace(c)
authorDenys Vlasenko <vda.linux@googlemail.com>
Wed, 6 Mar 2013 22:44:23 +0000 (23:44 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 6 Mar 2013 22:44:23 +0000 (23:44 +0100)
commit5198ed4bb36e3105a1f12bb3250bee78b6e0dd72
tree8b16d7227568b2e1b042cf882876feab9dbed9b9
parent76f61bec5e3dea55b2b50f2e8009642977b414e5
Open-code isprint(c) and isspace(c)

We don't call setlocale, thus we always use C locale.
But libc supports various other locales, and therefore
its ctype interface is general and at times inefficient.
For example, in glibc these macros result in function call,
whereas for e.g. isprint(c) just c >= ' ' && c <= 0x7e
suffices.

By open-coding ctype checks (we have only 4 of them)
we avoid function calls, we get smaller code:

   text    data     bss     dec     hex filename
 245127     680    5708  251515   3d67b strace_old
 245019     676    5708  251403   3d60b strace

and we don't link in ctype tables (beneficial for static builds).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
defs.h
file.c
util.c