treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / tools / lib / perf / core.c
blob58fc894b76c5fef04db35be87ad17c8d079967ae
1 // SPDX-License-Identifier: GPL-2.0-only
3 #define __printf(a, b) __attribute__((format(printf, a, b)))
5 #include <stdio.h>
6 #include <stdarg.h>
7 #include <unistd.h>
8 #include <linux/compiler.h>
9 #include <perf/core.h>
10 #include <internal/lib.h>
11 #include "internal.h"
13 static int __base_pr(enum libperf_print_level level __maybe_unused, const char *format,
14 va_list args)
16 return vfprintf(stderr, format, args);
19 static libperf_print_fn_t __libperf_pr = __base_pr;
21 __printf(2, 3)
22 void libperf_print(enum libperf_print_level level, const char *format, ...)
24 va_list args;
26 if (!__libperf_pr)
27 return;
29 va_start(args, format);
30 __libperf_pr(level, format, args);
31 va_end(args);
34 void libperf_init(libperf_print_fn_t fn)
36 page_size = sysconf(_SC_PAGE_SIZE);
37 __libperf_pr = fn;