From f28d968a67eab65e07e60ef8a8b19621c6401e82 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 18 Sep 2017 21:10:57 +0200 Subject: [PATCH] fix compilation with NDK > 14 --- tester/log_collection_tester.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tester/log_collection_tester.c b/tester/log_collection_tester.c index 9830b355b..7f607ec6b 100644 --- a/tester/log_collection_tester.c +++ b/tester/log_collection_tester.c @@ -28,11 +28,14 @@ #include #endif +#ifdef __ANDROID__ +#include "android/api-level.h" +#endif /*getline is POSIX 2008, not available on many systems.*/ -/* If Android target is set to 26 (with NDK r15c), use the following instead -#if defined(_WIN32) || defined(__QNX__)*/ -#if (defined(__ANDROID__) && !defined(__LP64__)) || defined(_WIN32) || defined(__QNX__) + +/*It is declared since NDK14 unified headers, that can be detected by the presence of __ANDROID_API_O__ define*/ +#if (defined(__ANDROID__) && __ANDROID_API__ <= 16) || defined(_WIN32) || defined(__QNX__) /* This code is public domain -- Will Hartung 4/9/09 */ static ssize_t getline(char **lineptr, size_t *n, FILE *stream) { char *bufptr = NULL;