Re: [PATCH] perf tools: Add _GNU_SOURCE macro for strndup()

From: Wang Liming
Date: Wed Dec 02 2009 - 03:12:40 EST


Xiao Guangrong wrote:

Liming Wang wrote:
strndup is a GNU extension. So add _GNU_SOURCE macro
to avoid compiling error.

Signed-off-by: Liming Wang <liming.wang@xxxxxxxxxxxxx>
Acked-by: Frederic Weisbecker <fweisbec@xxxxxxxxx>
---
tools/perf/util/string.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c
index 0977cf4..ea3eb39 100644
--- a/tools/perf/util/string.c
+++ b/tools/perf/util/string.c
@@ -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.
Agreed. It's a better method.

Liming Wang

#include "string.h"
#include "util.h"


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/