libyang BUGFIX set feature macro for strdup() on OSX
Since OS X requires different value (600) of _XOPEN_SOURCE feature test macro for
strdup() than linux (500), better use _POSIX_C_SOURCE 200809L. It is available
since glibc 2.12 (released 2010) so it shouldn't be an issue.
diff --git a/src/context.c b/src/context.c
index e345804..59c7093 100644
--- a/src/context.c
+++ b/src/context.c
@@ -12,6 +12,7 @@
* https://opensource.org/licenses/BSD-3-Clause
*/
#define _GNU_SOURCE /* asprintf */
+#define _POSIX_C_SOURCE 200809L /* strdup */
#include "context.h"
diff --git a/src/diff.c b/src/diff.c
index 31090f2..347ebf8 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -11,8 +11,7 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
-#define _XOPEN_SOURCE 500
-#define _POSIX_C_SOURCE 200809L
+#define _POSIX_C_SOURCE 200809L /* strdup */
#include "diff.h"
diff --git a/src/in.c b/src/in.c
index f802010..e4320f9 100644
--- a/src/in.c
+++ b/src/in.c
@@ -13,6 +13,11 @@
*/
#define _GNU_SOURCE
+#define _POSIX_C_SOURCE 200809L /* strdup, strndup */
+
+#ifdef __APPLE__
+#define _DARWIN_C_SOURCE /* F_GETPATH */
+#endif
#include "in.h"
#include "in_internal.h"
diff --git a/src/log.c b/src/log.c
index 1633b27..45f1750 100644
--- a/src/log.c
+++ b/src/log.c
@@ -13,6 +13,7 @@
*/
#define _GNU_SOURCE
+#define _POSIX_C_SOURCE 200809L /* strdup */
#include "log.h"
diff --git a/src/out.c b/src/out.c
index 13f462b..b74ed64 100644
--- a/src/out.c
+++ b/src/out.c
@@ -13,6 +13,7 @@
*/
#define _GNU_SOURCE
+#define _POSIX_C_SOURCE 200809L /* strdup, vdprintf */
#include "out.h"
#include "out_internal.h"
diff --git a/src/plugins_types.c b/src/plugins_types.c
index f3786eb..446b2f7 100644
--- a/src/plugins_types.c
+++ b/src/plugins_types.c
@@ -13,6 +13,7 @@
*/
#define _GNU_SOURCE
+#define _POSIX_C_SOURCE 200809L /* strdup */
#include "plugins_types.h"
diff --git a/src/schema_compile_node.c b/src/schema_compile_node.c
index a988e02..404150e 100644
--- a/src/schema_compile_node.c
+++ b/src/schema_compile_node.c
@@ -13,6 +13,7 @@
*/
#define _GNU_SOURCE
+#define _POSIX_C_SOURCE 200809L /* strdup, strndup */
#include "schema_compile_node.h"
diff --git a/src/tree_data_helpers.c b/src/tree_data_helpers.c
index c2134c0..5fed963 100644
--- a/src/tree_data_helpers.c
+++ b/src/tree_data_helpers.c
@@ -11,8 +11,7 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
-#define _XOPEN_SOURCE 500 /* strdup */
-#define _POSIX_C_SOURCE 200809L /*strndup */
+#define _POSIX_C_SOURCE 200809L /* strdup, strndup */
#include <assert.h>
#include <stdint.h>
diff --git a/src/tree_schema.c b/src/tree_schema.c
index 3d56842..54c5509 100644
--- a/src/tree_schema.c
+++ b/src/tree_schema.c
@@ -13,6 +13,7 @@
*/
#define _GNU_SOURCE
+#define _POSIX_C_SOURCE 200809L /* strdup */
#include "tree_schema.h"
diff --git a/src/validation.c b/src/validation.c
index 0877b85..f8bc3de 100644
--- a/src/validation.c
+++ b/src/validation.c
@@ -11,7 +11,7 @@
*
* https://opensource.org/licenses/BSD-3-Clause
*/
-#define _XOPEN_SOURCE 500 /* strdup */
+#define _POSIX_C_SOURCE 200809L /* strdup */
#include "validation.h"
diff --git a/src/xpath.c b/src/xpath.c
index 88403a0..c8beb28 100644
--- a/src/xpath.c
+++ b/src/xpath.c
@@ -12,6 +12,7 @@
* https://opensource.org/licenses/BSD-3-Clause
*/
#define _GNU_SOURCE
+#define _POSIX_C_SOURCE 200809L /* strdup, strndup */
/* needed by libmath functions isfinite(), isinf(), isnan(), signbit(), ... */
#define _ISOC99_SOURCE