aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/util.h
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-06-18 03:44:20 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-18 03:46:00 -0400
commita73c7d84a1975b44c0ebd03c2dec288af1426349 (patch)
tree34f6f154ec63b04e75148cc022d8a18198857d33 /tools/perf/util/util.h
parent7522060c95395f479ee4a6af3bbf9e097e92e48f (diff)
perf_counter tools: Add and use isprint()
Introduce isprint() to print out raw event dumps to ASCII, etc. (This is an extension to upstream Git's ctype.c.) Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Mike Galbraith <efault@gmx.de> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> LKML-Reference: <new-submission> [ removed openssl.h inclusion from util.h - it leaked ctype.h ] Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/util/util.h')
-rw-r--r--tools/perf/util/util.h19
1 files changed, 8 insertions, 11 deletions
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index ce9b514f60a3..b8cfed776d81 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -100,11 +100,6 @@
100#include <iconv.h> 100#include <iconv.h>
101#endif 101#endif
102 102
103#ifndef NO_OPENSSL
104#include <openssl/ssl.h>
105#include <openssl/err.h>
106#endif
107
108/* On most systems <limits.h> would have given us this, but 103/* On most systems <limits.h> would have given us this, but
109 * not on some systems (e.g. GNU/Hurd). 104 * not on some systems (e.g. GNU/Hurd).
110 */ 105 */
@@ -332,18 +327,20 @@ static inline int has_extension(const char *filename, const char *ext)
332#undef tolower 327#undef tolower
333#undef toupper 328#undef toupper
334extern unsigned char sane_ctype[256]; 329extern unsigned char sane_ctype[256];
335#define GIT_SPACE 0x01 330#define GIT_SPACE 0x01
336#define GIT_DIGIT 0x02 331#define GIT_DIGIT 0x02
337#define GIT_ALPHA 0x04 332#define GIT_ALPHA 0x04
338#define GIT_GLOB_SPECIAL 0x08 333#define GIT_GLOB_SPECIAL 0x08
339#define GIT_REGEX_SPECIAL 0x10 334#define GIT_REGEX_SPECIAL 0x10
335#define GIT_PRINT_EXTRA 0x20
336#define GIT_PRINT 0x3E
340#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0) 337#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
341#define isascii(x) (((x) & ~0x7f) == 0) 338#define isascii(x) (((x) & ~0x7f) == 0)
342#define isspace(x) sane_istest(x,GIT_SPACE) 339#define isspace(x) sane_istest(x,GIT_SPACE)
343#define isdigit(x) sane_istest(x,GIT_DIGIT) 340#define isdigit(x) sane_istest(x,GIT_DIGIT)
344#define isalpha(x) sane_istest(x,GIT_ALPHA) 341#define isalpha(x) sane_istest(x,GIT_ALPHA)
345#define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT) 342#define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT)
346#define issane(x) sane_istest(x,GIT_SPACE | GIT_DIGIT | GIT_ALPHA | GIT_GLOB_SPECIAL | GIT_REGEX_SPECIAL) 343#define isprint(x) sane_istest(x,GIT_PRINT)
347#define is_glob_special(x) sane_istest(x,GIT_GLOB_SPECIAL) 344#define is_glob_special(x) sane_istest(x,GIT_GLOB_SPECIAL)
348#define is_regex_special(x) sane_istest(x,GIT_GLOB_SPECIAL | GIT_REGEX_SPECIAL) 345#define is_regex_special(x) sane_istest(x,GIT_GLOB_SPECIAL | GIT_REGEX_SPECIAL)
349#define tolower(x) sane_case((unsigned char)(x), 0x20) 346#define tolower(x) sane_case((unsigned char)(x), 0x20)