diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-07-07 14:42:33 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-07-12 14:20:24 -0400 |
commit | d0761e37fe3fed7810ed8d6e130b79359f0c3e13 (patch) | |
tree | dec9e6cc9008a1b80856cbc1ec1897dce975776c /tools/include/linux/kernel.h | |
parent | 5496bc0c0d255f2a8a3a4c36087eb3b72ff63ea0 (diff) |
perf tools: Uninline scnprintf() and vscnprint()
They were in tools/include/linux/kernel.h, requiring that it in turn
included stdio.h, which is way too heavy.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-855h8olnkot9v0dajuee1lo3@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/include/linux/kernel.h')
-rw-r--r-- | tools/include/linux/kernel.h | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/tools/include/linux/kernel.h b/tools/include/linux/kernel.h index 76df53539c2a..28607db02bd3 100644 --- a/tools/include/linux/kernel.h +++ b/tools/include/linux/kernel.h | |||
@@ -2,8 +2,7 @@ | |||
2 | #define __TOOLS_LINUX_KERNEL_H | 2 | #define __TOOLS_LINUX_KERNEL_H |
3 | 3 | ||
4 | #include <stdarg.h> | 4 | #include <stdarg.h> |
5 | #include <stdio.h> | 5 | #include <stddef.h> |
6 | #include <stdlib.h> | ||
7 | #include <assert.h> | 6 | #include <assert.h> |
8 | 7 | ||
9 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) | 8 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) |
@@ -70,29 +69,8 @@ | |||
70 | #define cpu_to_le64(x) (x) | 69 | #define cpu_to_le64(x) (x) |
71 | #define cpu_to_le32(x) (x) | 70 | #define cpu_to_le32(x) (x) |
72 | 71 | ||
73 | static inline int | 72 | int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); |
74 | vscnprintf(char *buf, size_t size, const char *fmt, va_list args) | 73 | int scnprintf(char * buf, size_t size, const char * fmt, ...); |
75 | { | ||
76 | int i; | ||
77 | ssize_t ssize = size; | ||
78 | |||
79 | i = vsnprintf(buf, size, fmt, args); | ||
80 | |||
81 | return (i >= ssize) ? (ssize - 1) : i; | ||
82 | } | ||
83 | |||
84 | static inline int scnprintf(char * buf, size_t size, const char * fmt, ...) | ||
85 | { | ||
86 | va_list args; | ||
87 | ssize_t ssize = size; | ||
88 | int i; | ||
89 | |||
90 | va_start(args, fmt); | ||
91 | i = vsnprintf(buf, size, fmt, args); | ||
92 | va_end(args); | ||
93 | |||
94 | return (i >= ssize) ? (ssize - 1) : i; | ||
95 | } | ||
96 | 74 | ||
97 | /* | 75 | /* |
98 | * This looks more complex than it should be. But we need to | 76 | * This looks more complex than it should be. But we need to |