perf tools: Add _GNU_SOURCE macro for strndup()
PATCH 1/1 perf tools: Add _GNU_SOURCE macro for strndup()
strndup is a GNU extension. So add _GNU_SOURCE macro to avoid compiling error.
--- tools/perf/util/string.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
tools/perf/util/string.c +3 -0
@@ -1,5 +1,8 @@ +#define _GNU_SOURCE#include <string.h> #include <stdlib.h> + +#undef _GNU_SOURCE#include "string.h" #include "util.h"
Signature · 1 line
1.6.0.3
Quoted 14 lines · Liming Wang
strndup is a GNU extension. So add
_GNU_SOURCEmacro to avoid compiling error.Signed-off-by Liming Wang <[email protected]>--- tools/perf/util/string.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)tools/perf/util/string.c +0
-0
tools/perf/util/string.c line 5
Quoted 5 lines
tools/perf/util/string.c +3
-0@@ -1,5 +1,8 @@ +#define _GNU_SOURCE#include <string.h> #include <stdlib.h> + +#undef _GNU_SOURCE
I think those two "#include" can be removed,
because util.h include it.
Quoted 3 lines
tools/perf/util/string.c +0
-0#include "string.h" #include "util.h"
Quoted 11 lines · Xiao Guangrong
Quoted 9 lines · Liming Wang
strndup is a GNU extension. So add
_GNU_SOURCEmacro to avoid compiling error.Signed-off-by Liming Wang <[email protected]>--- tools/perf/util/string.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
Quoted 13 lines
tools/perf/util/string.c line 5
Quoted 10 lines
tools/perf/util/string.c +3
-0@@ -1,5 +1,8 @@ +#define _GNU_SOURCE#include <string.h> #include <stdlib.h> + +#undef _GNU_SOURCEI think those two "#include" can be removed,
becauseutil.hinclude it.
Agreed. It's a better method.
Liming Wang
Quoted 5 lines
Quoted 4 lines
tools/perf/util/string.c +0
-0#include "string.h" #include "util.h"
[tip:perf/core] perf tools: Fix _GNU_SOURCE macro related strndup() build error
In reply to Liming WangCommit-ID: c19e33aa840e9202ef8d4c93056b59f3edc2208d Gitweb: http://git.kernel.org/tip/c19e33aa840e9202ef8d4c93056b59f3edc2208d Author: Liming Wang <[email protected]> AuthorDate: Wed, 2 Dec 2009 14:11:46 +0800 Committer: Ingo Molnar <[email protected]> CommitDate: Wed, 2 Dec 2009 09:24:56 +0100
perf tools: Fix _GNU_SOURCE macro related strndup() build error
strndup is a GNU extension. So dont include string.h without defining _GNU_SOURCE (it results in a compile error otherwise).
Remove these includes as util.h does it already.
LKML-Reference: <[email protected]>
--- tools/perf/util/string.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-)
tools/perf/util/string.c +0 -2
@@ -1,5 +1,3 @@ -#include <string.h> -#include <stdlib.h> #include "string.h" #include "util.h"