Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf tools: Make is_printable_array global

It's used from 2 objects in perf, so it's better to keep just one copy.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Pirko <jiri@mellanox.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Steven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1468685480-18951-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Jiri Olsa and committed by
Arnaldo Carvalho de Melo
accaed26 249de6e0

+17 -28
-12
tools/perf/util/python.c
··· 295 295 return pevent->evsel->attr.type == PERF_TYPE_TRACEPOINT; 296 296 } 297 297 298 - static int is_printable_array(char *p, unsigned int len) 299 - { 300 - unsigned int i; 301 - 302 - for (i = 0; i < len; i++) { 303 - if (!isprint(p[i]) && !isspace(p[i])) 304 - return 0; 305 - } 306 - 307 - return 1; 308 - } 309 - 310 298 static PyObject* 311 299 tracepoint_field(struct pyrf_event *pe, struct format_field *field) 312 300 {
-16
tools/perf/util/scripting-engines/trace-event-python.c
··· 386 386 return pylist; 387 387 } 388 388 389 - static int is_printable_array(char *p, unsigned int len) 390 - { 391 - unsigned int i; 392 - 393 - if (!p || !len || p[len - 1] != 0) 394 - return 0; 395 - 396 - len--; 397 - 398 - for (i = 0; i < len; i++) { 399 - if (!isprint(p[i]) && !isspace(p[i])) 400 - return 0; 401 - } 402 - return 1; 403 - } 404 - 405 389 static void python_process_tracepoint(struct perf_sample *sample, 406 390 struct perf_evsel *evsel, 407 391 struct addr_location *al)
+16
tools/perf/util/util.c
··· 746 746 } 747 747 printer(BINARY_PRINT_DATA_END, -1, extra); 748 748 } 749 + 750 + int is_printable_array(char *p, unsigned int len) 751 + { 752 + unsigned int i; 753 + 754 + if (!p || !len || p[len - 1] != 0) 755 + return 0; 756 + 757 + len--; 758 + 759 + for (i = 0; i < len; i++) { 760 + if (!isprint(p[i]) && !isspace(p[i])) 761 + return 0; 762 + } 763 + return 1; 764 + }
+1
tools/perf/util/util.h
··· 364 364 extern int sched_getcpu(void); 365 365 #endif 366 366 367 + int is_printable_array(char *p, unsigned int len); 367 368 #endif /* GIT_COMPAT_UTIL_H */