]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
tools perf: Move from sane_ctype.h obtained from git to the Linux's original
authorArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 25 Jun 2019 20:27:31 +0000 (17:27 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 26 Jun 2019 00:02:47 +0000 (21:02 -0300)
We got the sane_ctype.h headers from git and kept using it so far, but
since that code originally came from the kernel sources to the git
sources, perhaps its better to just use the one in the kernel, so that
we can leverage tools/perf/check_headers.sh to be notified when our copy
gets out of sync, i.e. when fixes or goodies are added to the code we've
copied.

This will help with things like tools/lib/string.c where we want to have
more things in common with the kernel, such as strim(), skip_spaces(),
etc so as to go on removing the things that we have in tools/perf/util/
and instead using the code in the kernel, indirectly and removing things
like EXPORT_SYMBOL(), etc, getting notified when fixes and improvements
are made to the original code.

Hopefully this also should help with reducing the difference of code
hosted in tools/ to the one in the kernel proper.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lkml.kernel.org/n/tip-7k9868l713wqtgo01xxygn12@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
46 files changed:
tools/include/linux/ctype.h [new file with mode: 0644]
tools/lib/ctype.c [new file with mode: 0644]
tools/lib/symbol/kallsyms.c
tools/lib/symbol/kallsyms.h
tools/perf/MANIFEST
tools/perf/arch/x86/util/machine.c
tools/perf/builtin-kmem.c
tools/perf/builtin-report.c
tools/perf/builtin-sched.c
tools/perf/builtin-script.c
tools/perf/builtin-stat.c
tools/perf/builtin-top.c
tools/perf/builtin-trace.c
tools/perf/check-headers.sh
tools/perf/tests/code-reading.c
tools/perf/ui/browser.c
tools/perf/ui/browsers/hists.c
tools/perf/ui/browsers/map.c
tools/perf/ui/stdio/hist.c
tools/perf/util/Build
tools/perf/util/annotate.c
tools/perf/util/auxtrace.c
tools/perf/util/build-id.c
tools/perf/util/config.c
tools/perf/util/cpumap.c
tools/perf/util/ctype.c [deleted file]
tools/perf/util/data-convert-bt.c
tools/perf/util/debug.c
tools/perf/util/demangle-java.c
tools/perf/util/env.c
tools/perf/util/event.c
tools/perf/util/evsel.c
tools/perf/util/header.c
tools/perf/util/jitdump.c
tools/perf/util/machine.c
tools/perf/util/print_binary.c
tools/perf/util/probe-event.c
tools/perf/util/probe-finder.h
tools/perf/util/python-ext-sources
tools/perf/util/sane_ctype.h [deleted file]
tools/perf/util/stat-display.c
tools/perf/util/strfilter.c
tools/perf/util/string.c
tools/perf/util/symbol-elf.c
tools/perf/util/symbol.c
tools/perf/util/trace-event-parse.c

diff --git a/tools/include/linux/ctype.h b/tools/include/linux/ctype.h
new file mode 100644 (file)
index 0000000..310090b
--- /dev/null
@@ -0,0 +1,75 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_CTYPE_H
+#define _LINUX_CTYPE_H
+
+/*
+ * NOTE! This ctype does not handle EOF like the standard C
+ * library is required to.
+ */
+
+#define _U     0x01    /* upper */
+#define _L     0x02    /* lower */
+#define _D     0x04    /* digit */
+#define _C     0x08    /* cntrl */
+#define _P     0x10    /* punct */
+#define _S     0x20    /* white space (space/lf/tab) */
+#define _X     0x40    /* hex digit */
+#define _SP    0x80    /* hard space (0x20) */
+
+extern const unsigned char _ctype[];
+
+#define __ismask(x) (_ctype[(int)(unsigned char)(x)])
+
+#define isalnum(c)     ((__ismask(c)&(_U|_L|_D)) != 0)
+#define isalpha(c)     ((__ismask(c)&(_U|_L)) != 0)
+#define iscntrl(c)     ((__ismask(c)&(_C)) != 0)
+static inline int __isdigit(int c)
+{
+       return '0' <= c && c <= '9';
+}
+#define isdigit(c)     __isdigit(c)
+#define isgraph(c)     ((__ismask(c)&(_P|_U|_L|_D)) != 0)
+#define islower(c)     ((__ismask(c)&(_L)) != 0)
+#define isprint(c)     ((__ismask(c)&(_P|_U|_L|_D|_SP)) != 0)
+#define ispunct(c)     ((__ismask(c)&(_P)) != 0)
+/* Note: isspace() must return false for %NUL-terminator */
+#define isspace(c)     ((__ismask(c)&(_S)) != 0)
+#define isupper(c)     ((__ismask(c)&(_U)) != 0)
+#define isxdigit(c)    ((__ismask(c)&(_D|_X)) != 0)
+
+#define isascii(c) (((unsigned char)(c))<=0x7f)
+#define toascii(c) (((unsigned char)(c))&0x7f)
+
+static inline unsigned char __tolower(unsigned char c)
+{
+       if (isupper(c))
+               c -= 'A'-'a';
+       return c;
+}
+
+static inline unsigned char __toupper(unsigned char c)
+{
+       if (islower(c))
+               c -= 'a'-'A';
+       return c;
+}
+
+#define tolower(c) __tolower(c)
+#define toupper(c) __toupper(c)
+
+/*
+ * Fast implementation of tolower() for internal usage. Do not use in your
+ * code.
+ */
+static inline char _tolower(const char c)
+{
+       return c | 0x20;
+}
+
+/* Fast check for octal digit */
+static inline int isodigit(const char c)
+{
+       return c >= '0' && c <= '7';
+}
+
+#endif
diff --git a/tools/lib/ctype.c b/tools/lib/ctype.c
new file mode 100644 (file)
index 0000000..4d2e05f
--- /dev/null
@@ -0,0 +1,35 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ *  linux/lib/ctype.c
+ *
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <linux/ctype.h>
+#include <linux/compiler.h>
+
+const unsigned char _ctype[] = {
+_C,_C,_C,_C,_C,_C,_C,_C,                               /* 0-7 */
+_C,_C|_S,_C|_S,_C|_S,_C|_S,_C|_S,_C,_C,                        /* 8-15 */
+_C,_C,_C,_C,_C,_C,_C,_C,                               /* 16-23 */
+_C,_C,_C,_C,_C,_C,_C,_C,                               /* 24-31 */
+_S|_SP,_P,_P,_P,_P,_P,_P,_P,                           /* 32-39 */
+_P,_P,_P,_P,_P,_P,_P,_P,                               /* 40-47 */
+_D,_D,_D,_D,_D,_D,_D,_D,                               /* 48-55 */
+_D,_D,_P,_P,_P,_P,_P,_P,                               /* 56-63 */
+_P,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U|_X,_U,             /* 64-71 */
+_U,_U,_U,_U,_U,_U,_U,_U,                               /* 72-79 */
+_U,_U,_U,_U,_U,_U,_U,_U,                               /* 80-87 */
+_U,_U,_U,_P,_P,_P,_P,_P,                               /* 88-95 */
+_P,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L|_X,_L,             /* 96-103 */
+_L,_L,_L,_L,_L,_L,_L,_L,                               /* 104-111 */
+_L,_L,_L,_L,_L,_L,_L,_L,                               /* 112-119 */
+_L,_L,_L,_P,_P,_P,_P,_C,                               /* 120-127 */
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                       /* 128-143 */
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,                       /* 144-159 */
+_S|_SP,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,   /* 160-175 */
+_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,_P,       /* 176-191 */
+_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,_U,       /* 192-207 */
+_U,_U,_U,_U,_U,_U,_U,_P,_U,_U,_U,_U,_U,_U,_U,_L,       /* 208-223 */
+_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,_L,       /* 224-239 */
+_L,_L,_L,_L,_L,_L,_L,_P,_L,_L,_L,_L,_L,_L,_L,_L};      /* 240-255 */
index 7501611abee4d34da86cb22e304fca0f97197dbb..1a7a9f87709587dfc5d8d11226f1555cc4e30ad7 100644 (file)
@@ -1,5 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-#include <ctype.h>
 #include "symbol/kallsyms.h"
 #include <stdio.h>
 #include <stdlib.h>
index 2b238f181d97c3dc40b28800468177d558c999fa..bd988f7b18d4a12d69d2eb43c0710ea266642e72 100644 (file)
@@ -3,6 +3,7 @@
 #define __TOOLS_KALLSYMS_H_ 1
 
 #include <elf.h>
+#include <linux/ctype.h>
 #include <linux/types.h>
 
 #ifndef KSYM_NAME_LEN
index 627b7cada1442b65dbbcc600661f35caf8429cdc..aac4c755d81b741e1c29e0cc3fa3fd7e7ca41223 100644 (file)
@@ -7,6 +7,7 @@ tools/lib/traceevent
 tools/lib/api
 tools/lib/bpf
 tools/lib/subcmd
+tools/lib/ctype.c
 tools/lib/hweight.c
 tools/lib/rbtree.c
 tools/lib/string.c
index 0e508f26f83a1ecc43f96224afd870649329e374..1e9ec783b9a14e97de91f419686962c9351f48a9 100644 (file)
@@ -7,7 +7,7 @@
 #include "../../util/machine.h"
 #include "../../util/map.h"
 #include "../../util/symbol.h"
-#include "../../util/sane_ctype.h"
+#include <linux/ctype.h>
 
 #include <symbol/kallsyms.h>
 
index b833b03d71957f3f6bd39236329b3b130220888a..9bd3829de76d4c72f7974c9f49ab948dfb74f209 100644 (file)
@@ -31,7 +31,7 @@
 #include <locale.h>
 #include <regex.h>
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 static int     kmem_slab;
 static int     kmem_page;
index 91c40808380d7e86fd4f6de86705256259f3f455..91a3762b421119b90a2e95b8cb8361eaed9fa7e8 100644 (file)
@@ -47,7 +47,7 @@
 #include <errno.h>
 #include <inttypes.h>
 #include <regex.h>
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 #include <signal.h>
 #include <linux/bitmap.h>
 #include <linux/stringify.h>
index 79577b67c8981e28379528e8bf52a7b0f4798df0..1519989961ffec51d0362ec8fa9eac9526296d6f 100644 (file)
@@ -37,7 +37,7 @@
 #include <api/fs/fs.h>
 #include <linux/time64.h>
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 #define PR_SET_NAME            15               /* Set process name */
 #define MAX_CPUS               4096
index 61f00055476a12765f2460ab8a721e5ab94914bd..0131f7a0d48d10f99a456207307dee9d8d76b129 100644 (file)
@@ -49,7 +49,7 @@
 #include <unistd.h>
 #include <subcmd/pager.h>
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 static char const              *script_name;
 static char const              *generate_script_lang;
index 8a35fc5a7281b3f565950baa2e090d0c9c72a430..e5e19b4610619f75a4aa9ee1926a33fb7d65e484 100644 (file)
@@ -82,7 +82,7 @@
 #include <sys/time.h>
 #include <sys/resource.h>
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 #define DEFAULT_SEPARATOR      " "
 #define FREEZE_ON_SMI_PATH     "devices/cpu/freeze_on_smi"
index 4ef02e6888ff1e51f2d3813503865ebd9f84c82c..6d40a4ef58c5d544c89a974f13529c3c90827aae 100644 (file)
@@ -76,7 +76,7 @@
 #include <linux/time64.h>
 #include <linux/types.h>
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 static volatile int done;
 static volatile int resize;
index f3532b081b317c4279a815be76623d215377f1f9..d0eb7224dd36db1ee99d178594da182f5832510d 100644 (file)
@@ -64,7 +64,7 @@
 #include <fcntl.h>
 #include <sys/sysmacros.h>
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 #ifndef O_CLOEXEC
 # define O_CLOEXEC             02000000
index c68ee06cae637fe5aad2c51e2dba1e16af0b5064..f211c015cb764b08d5d6533c08c96a1e92bdd913 100755 (executable)
@@ -105,6 +105,8 @@ check arch/x86/lib/memcpy_64.S        '-I "^EXPORT_SYMBOL" -I "^#include <asm/ex
 check arch/x86/lib/memset_64.S        '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>"'
 check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common\(-tools\)*.h>"'
 check include/uapi/linux/mman.h       '-I "^#include <\(uapi/\)*asm/mman.h>"'
+check include/linux/ctype.h          '-I "isdigit("'
+check lib/ctype.c                    '-I "^EXPORT_SYMBOL" -I "^#include <linux/export.h>" -B'
 
 # diff non-symmetric files
 check_2 tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
index 4ebd2681e7607c2efda177eb3f9f6956f8082bba..aa6df122b17550cf191a8c1a0c6fade09b8ffa24 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "tests.h"
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 #define BUFSZ  1024
 #define READLEN        128
index 4ad37d8c7d6a16a4ffb158788c82f45174728115..8812c1564995b26eccbeccbf337d1d30cb7243ae 100644 (file)
@@ -16,7 +16,7 @@
 #include "helpline.h"
 #include "keysyms.h"
 #include "../color.h"
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 static int ui_browser__percent_color(struct ui_browser *browser,
                                     double percent, bool current)
index 3421ecbdd3f046c42e4b5ef578abf11bfb591b64..59483bdb0027dcd7738bd6b949eefce841b3ed41 100644 (file)
@@ -33,7 +33,7 @@
 #include "units.h"
 #include "time-utils.h"
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 extern void hist_browser__init_hpp(void);
 
index c70d9337405b6eca43200a59965eba8b01aadf85..5f6529c9eb8e9f43ca773abc4d5a14a9e3729f6e 100644 (file)
@@ -13,7 +13,7 @@
 #include "../keysyms.h"
 #include "map.h"
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 struct map_browser {
        struct ui_browser b;
index 4c97e3cdf173801e6a9edc9ada37013ee8ae0baa..4b1a6e921d1cc39a1b66cf82f8c0ee36b07358d0 100644 (file)
@@ -13,7 +13,7 @@
 #include "../../util/srcline.h"
 #include "../../util/string2.h"
 #include "../../util/thread.h"
-#include "../../util/sane_ctype.h"
+#include <linux/ctype.h>
 
 static size_t callchain__fprintf_left_margin(FILE *fp, int left_margin)
 {
index 6d5bbc8b589b061be2b6b1c8726d7aa5020f1705..b4dc6112138f3bda6cc7e68b2f485fd25c2af435 100644 (file)
@@ -213,6 +213,10 @@ $(OUTPUT)util/bitmap.o: ../lib/bitmap.c FORCE
        $(call rule_mkdir)
        $(call if_changed_dep,cc_o_c)
 
+$(OUTPUT)util/ctype.o: ../lib/ctype.c FORCE
+       $(call rule_mkdir)
+       $(call if_changed_dep,cc_o_c)
+
 $(OUTPUT)util/find_bit.o: ../lib/find_bit.c FORCE
        $(call rule_mkdir)
        $(call if_changed_dep,cc_o_c)
index c8ce13419d9b03feb697c1acfebfa05e67b9334c..65005ccea232ccbed3b5852f08704b8b01da845a 100644 (file)
@@ -49,7 +49,7 @@
 #define DARROW_CHAR    ((unsigned char)'.')
 #define UARROW_CHAR    ((unsigned char)'-')
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 struct annotation_options annotation__default_options = {
        .use_offset     = true,
index cfdbf65f1e02090c7a552ef5571214870fcb5bc7..bc215fe0b4b4e3c9570620fb0a7ddaeba5969129 100644 (file)
@@ -51,7 +51,7 @@
 #include "arm-spe.h"
 #include "s390-cpumsf.h"
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 #include "symbol/kallsyms.h"
 
 static bool auxtrace__dont_decode(struct perf_session *session)
index 0c5517a8d0b772bc25acc1e9309fb4e00502965a..89c6913dfc25998e49ea18136f34ef6fcd5d6d32 100644 (file)
@@ -29,7 +29,7 @@
 #include "probe-file.h"
 #include "strlist.h"
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 static bool no_buildid_cache;
 
index e7d2c08d263a09f1233044b87529426729cac2b2..752cce853e51ba5426ebbba7a201c7c755938017 100644 (file)
@@ -24,7 +24,7 @@
 #include <unistd.h>
 #include <linux/string.h>
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 #define MAXNAME (256)
 
index c11a459ca58293b057fc9cb48913b540da349e34..0d8fbedf7bd5563fc5ee7f77abbfee39dd229112 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/bitmap.h>
 #include "asm/bug.h"
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 static int max_cpu_num;
 static int max_present_cpu_num;
diff --git a/tools/perf/util/ctype.c b/tools/perf/util/ctype.c
deleted file mode 100644 (file)
index f84ecd9..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- * Sane locale-independent, ASCII ctype.
- *
- * No surprises, and works with signed and unsigned chars.
- */
-#include "sane_ctype.h"
-
-enum {
-       S = GIT_SPACE,
-       A = GIT_ALPHA,
-       D = GIT_DIGIT,
-       G = GIT_GLOB_SPECIAL,   /* *, ?, [, \\ */
-       R = GIT_REGEX_SPECIAL,  /* $, (, ), +, ., ^, {, | * */
-       P = GIT_PRINT_EXTRA,    /* printable - alpha - digit - glob - regex */
-
-       PS = GIT_SPACE | GIT_PRINT_EXTRA,
-};
-
-unsigned char sane_ctype[256] = {
-/*     0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F                      */
-
-       0, 0, 0, 0, 0, 0, 0, 0, 0, S, S, 0, 0, S, 0, 0,         /*   0.. 15 */
-       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,         /*  16.. 31 */
-       PS,P, P, P, R, P, P, P, R, R, G, R, P, P, R, P,         /*  32.. 47 */
-       D, D, D, D, D, D, D, D, D, D, P, P, P, P, P, G,         /*  48.. 63 */
-       P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,         /*  64.. 79 */
-       A, A, A, A, A, A, A, A, A, A, A, G, G, P, R, P,         /*  80.. 95 */
-       P, A, A, A, A, A, A, A, A, A, A, A, A, A, A, A,         /*  96..111 */
-       A, A, A, A, A, A, A, A, A, A, A, R, R, P, P, 0,         /* 112..127 */
-       /* Nothing in the 128.. range */
-};
index b79e1d6839ed75799287e24825860beb78d84f74..7b06e7373b9e7abd5ac3394c29954f05d5c644eb 100644 (file)
@@ -29,7 +29,7 @@
 #include "evsel.h"
 #include "machine.h"
 #include "config.h"
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 #define pr_N(n, fmt, ...) \
        eprintf(n, debug_data_convert, fmt, ##__VA_ARGS__)
index 3d6459626c2af826dc8a4537c3b51bf95063f10c..3cc578343f48894ef0da8c7f640796ff622a6c51 100644 (file)
@@ -21,7 +21,7 @@
 #include "util.h"
 #include "target.h"
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 int verbose;
 bool dump_trace = false, quiet = false;
index e4c48675605319db28978d3827874416ad225eac..5b4900d67c80075f4d1e913570b01a5be030633f 100644 (file)
@@ -8,7 +8,7 @@
 
 #include "demangle-java.h"
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 enum {
        MODE_PREFIX = 0,
index 1cc7a18378223da4691b6922242466fb362d7f67..22eee8942527a27e52adef024b1c3dc0ba752f69 100644 (file)
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "cpumap.h"
 #include "env.h"
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 #include "util.h"
 #include "bpf-event.h"
 #include <errno.h>
index c9c6857360e44db907d12d823da7c745721ef696..d8f8a20543c5456d30d6b2e0bbbdcb92b5483dfe 100644 (file)
@@ -20,7 +20,7 @@
 #include "strlist.h"
 #include "thread.h"
 #include "thread_map.h"
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 #include "map.h"
 #include "symbol.h"
 #include "symbol/kallsyms.h"
index 4b175166d2645aebc7effe60200520a0a4f13db5..5ab31a4a658dd4ce696baada7027dbae7679abd5 100644 (file)
@@ -39,7 +39,7 @@
 #include "memswap.h"
 #include "util/parse-branch-options.h"
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 struct perf_missing_features perf_missing_features;
 
index abc9c2145efefecfc6dcc5c85a2c57874f3a58ac..fca9dbaf61ae5edd874bef5d330a4888f1831a8a 100644 (file)
@@ -43,7 +43,7 @@
 #include "cputopo.h"
 #include "bpf-event.h"
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 /*
  * magic2 = "PERFILE2"
index eda28d3570bc0deff3fd4237149db54986d204ed..28908afedec49122bf3a22cab94317dc7f637965 100644 (file)
@@ -28,7 +28,7 @@
 #include "genelf.h"
 #include "../builtin.h"
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 struct jit_buf_desc {
        struct perf_data *output;
index a0bb05dd008fd088d0176a593aa3722ffc7dfc6d..1b3d7265bca96b1cfdb7fd6c55ef1144b683663a 100644 (file)
@@ -25,7 +25,7 @@
 #include "asm/bug.h"
 #include "bpf-event.h"
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 #include <symbol/kallsyms.h>
 #include <linux/mman.h>
 
index 23e3670634465c6061b19e4b26c628902cfb4a6e..599a1543871de113e1ca985a7103720def06a3e2 100644 (file)
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0
 #include "print_binary.h"
 #include <linux/log2.h>
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 int binary__fprintf(unsigned char *data, size_t len,
                    size_t bytes_per_line, binary__fprintf_t printer,
index 2ebf8673f8e95382c8742f30ccb22afc41c77508..6f24eaf6e50407abe1ea29c413e6f2b0c54598ee 100644 (file)
@@ -39,7 +39,7 @@
 #include "session.h"
 #include "string2.h"
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 #define PERFPROBE_GROUP "probe"
 
index 16252980ff00b1a90ecd100c904dd23b3049c27a..670c477bf8cf3966f0de238633b759e02aeaffe4 100644 (file)
@@ -5,7 +5,7 @@
 #include <stdbool.h>
 #include "intlist.h"
 #include "probe-event.h"
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 #define MAX_PROBE_BUFFER       1024
 #define MAX_PROBES              128
index 7aa0ea64544ecf4fec8e6a843c244d4bf2d3653c..648bcd80b47587de1fd9eebb28cdc4b620d3281c 100644 (file)
@@ -6,7 +6,7 @@
 #
 
 util/python.c
-util/ctype.c
+../lib/ctype.c
 util/evlist.c
 util/evsel.c
 util/cpumap.c
diff --git a/tools/perf/util/sane_ctype.h b/tools/perf/util/sane_ctype.h
deleted file mode 100644 (file)
index c4dce9e..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _PERF_SANE_CTYPE_H
-#define _PERF_SANE_CTYPE_H
-
-/* Sane ctype - no locale, and works with signed chars */
-#undef isascii
-#undef isspace
-#undef isdigit
-#undef isxdigit
-#undef isalpha
-#undef isprint
-#undef isalnum
-#undef islower
-#undef isupper
-#undef tolower
-#undef toupper
-
-extern unsigned char sane_ctype[256];
-#define GIT_SPACE              0x01
-#define GIT_DIGIT              0x02
-#define GIT_ALPHA              0x04
-#define GIT_GLOB_SPECIAL       0x08
-#define GIT_REGEX_SPECIAL      0x10
-#define GIT_PRINT_EXTRA                0x20
-#define GIT_PRINT              0x3E
-#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
-#define isascii(x) (((x) & ~0x7f) == 0)
-#define isspace(x) sane_istest(x,GIT_SPACE)
-#define isdigit(x) sane_istest(x,GIT_DIGIT)
-#define isxdigit(x)    \
-       (sane_istest(toupper(x), GIT_ALPHA | GIT_DIGIT) && toupper(x) < 'G')
-#define isalpha(x) sane_istest(x,GIT_ALPHA)
-#define isalnum(x) sane_istest(x,GIT_ALPHA | GIT_DIGIT)
-#define isprint(x) sane_istest(x,GIT_PRINT)
-#define islower(x) (sane_istest(x,GIT_ALPHA) && (x & 0x20))
-#define isupper(x) (sane_istest(x,GIT_ALPHA) && !(x & 0x20))
-#define tolower(x) sane_case((unsigned char)(x), 0x20)
-#define toupper(x) sane_case((unsigned char)(x), 0)
-
-static inline int sane_case(int x, int high)
-{
-       if (sane_istest(x, GIT_ALPHA))
-               x = (x & ~0x20) | high;
-       return x;
-}
-
-#endif /* _PERF_SANE_CTYPE_H */
index a6b9de3e83fc7bb3747faa43e17e0c2d56298911..992e327bce8567faaf172edbc2cb60758d991bce 100644 (file)
@@ -10,7 +10,7 @@
 #include "thread_map.h"
 #include "cpumap.h"
 #include "string2.h"
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 #include "cgroup.h"
 #include <math.h>
 #include <api/fs/fs.h>
index 7f3253d44afdef572cb2505bd2d60fdedfa71101..2c3a2904ebcd985a747ca1ff76bc0c4b02ec83d8 100644 (file)
@@ -4,7 +4,7 @@
 #include "strfilter.h"
 
 #include <errno.h>
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 /* Operators */
 static const char *OP_and      = "&";  /* Logical AND */
index b18884bd673b8e1b191004d0928931a5757b9f04..084c3e4e9400355560dab53b0171c532f2743ffe 100644 (file)
@@ -4,7 +4,7 @@
 #include <linux/string.h>
 #include <stdlib.h>
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 const char *graph_dotted_line =
        "---------------------------------------------------------------------"
index f04ef851ae863f9db50f749a0ac5b83646d9391b..62008756d8ccf8e9d73a2f79c9e583a746aa5ad0 100644 (file)
@@ -15,7 +15,7 @@
 #include "vdso.h"
 #include "debug.h"
 #include "util.h"
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 #include <symbol/kallsyms.h>
 
 #ifndef EM_AARCH64
index f4540f8bbed11bc0471c8e3ddbc3cd3793b22150..46d2c03814a1df389f832ba264a43f1fcb3cd2db 100644 (file)
@@ -25,7 +25,7 @@
 #include "namespaces.h"
 #include "header.h"
 #include "path.h"
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 #include <elf.h>
 #include <limits.h>
index 62bc61155dd141f95345ec26662544c580079a62..b3982e1bb4c55f65c9fe4f105023dba41a408e37 100644 (file)
@@ -11,7 +11,7 @@
 #include "debug.h"
 #include "trace-event.h"
 
-#include "sane_ctype.h"
+#include <linux/ctype.h>
 
 static int get_common_field(struct scripting_context *context,
                            int *offset, int *size, const char *type)