diff options
author | Ingo Molnar <mingo@kernel.org> | 2013-10-01 13:26:13 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2013-10-09 08:48:49 +0200 |
commit | fb1c9185e36cf9c616ac15f54e54a01f052672bd (patch) | |
tree | ab6bcf354a39a2e662fd3492ca9f8b4384b3a7d9 /tools/perf/util/path.c | |
parent | 7a10822a30060eceddda16c051086c00acb449c9 (diff) | |
download | linux-fb1c9185e36cf9c616ac15f54e54a01f052672bd.tar.bz2 |
tools/perf: Turn strlcpy() into a __weak function
The strlcpy() feature check slows every build unnecessarily - so make it
a __weak function so it does not have to be auto-detected.
If the libc (or any other library) has an strlcpy() implementation it will
be used - otherwise our fallback is active.
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Link: http://lkml.kernel.org/n/tip-zjbrcupapu08ePsyYhhhxiwk@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/util/path.c')
-rw-r--r-- | tools/perf/util/path.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/perf/util/path.c b/tools/perf/util/path.c index f3958743b743..5d13cb45b317 100644 --- a/tools/perf/util/path.c +++ b/tools/perf/util/path.c @@ -22,19 +22,23 @@ static const char *get_perf_dir(void) return "."; } -#ifndef HAVE_STRLCPY_SUPPORT -size_t strlcpy(char *dest, const char *src, size_t size) +/* + * If libc has strlcpy() then that version will override this + * implementation: + */ +size_t __weak strlcpy(char *dest, const char *src, size_t size) { size_t ret = strlen(src); if (size) { size_t len = (ret >= size) ? size - 1 : ret; + memcpy(dest, src, len); dest[len] = '\0'; } + return ret; } -#endif static char *get_pathname(void) { |