From ebfa1718a36a8a0f3cf4571bc48b1990129af703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Wed, 2 Feb 2022 09:18:58 +0800 Subject: Fix Android macro and tidy up --- search.c | 17 ++++++++++++----- ticket.c | 23 +++++++++++++---------- user.c | 17 ++++++++++++----- 3 files changed, 37 insertions(+), 20 deletions(-) diff --git a/search.c b/search.c index 9a98f12..03ab593 100644 --- a/search.c +++ b/search.c @@ -1,3 +1,10 @@ +#ifdef DEBUG +#ifdef __ANDROID__ +#include +#else +#include +#endif +#endif #include #include "request.h" #include "rtclient/ticket.h" @@ -52,13 +59,13 @@ static size_t ticket_handler(void *contents, size_t size, size_t nmemb } } else { #ifdef DEBUG -#ifdef ANDROID - __android_log_print(ANDROID_LOG_INFO, "librtclient" - , "%s response status:\n%s", __func__, line); +#ifdef __ANDROID__ + __android_log_print(ANDROID_LOG_INFO, "librtclient", + "%s response status:\n%s", __func__, line); #else printf("%s response status:\n%s\n", __func__, line); -#endif // ANDROID -#endif // DEBUG +#endif +#endif } return realsize; diff --git a/ticket.c b/ticket.c index d0bcbaf..9053d71 100644 --- a/ticket.c +++ b/ticket.c @@ -1,3 +1,6 @@ +#if defined __ANDROID__ && defined DEBUG +#include +#endif #include #include "post.h" #include "rtclient/ticket.h" @@ -93,13 +96,13 @@ static size_t history_handler(void *contents, size_t size, size_t nmemb } } else { #ifdef DEBUG -#ifdef ANDROID - __android_log_print(ANDROID_LOG_INFO, "librtclient" - , "%s response status:\n%s", __func__, line); +#ifdef __ANDROID__ + __android_log_print(ANDROID_LOG_INFO, "librtclient", + "%s response status:\n%s", __func__, line); #else printf("%s response status:\n%s\n", __func__, line); -#endif // ANDROID -#endif // DEBUG +#endif +#endif } return realsize; @@ -295,13 +298,13 @@ static size_t history_l_handler(void *contents, size_t size, size_t nmemb } } else { #ifdef DEBUG -#ifdef ANDROID - __android_log_print(ANDROID_LOG_INFO, "librtclient" - , "%s response status:\n%s", __func__, line); +#ifdef __ANDROID__ + __android_log_print(ANDROID_LOG_INFO, "librtclient", + "%s response status:\n%s", __func__, line); #else printf("%s response status:\n%s\n", __func__, line); -#endif // ANDROID -#endif // DEBUG +#endif +#endif } return realsize; diff --git a/user.c b/user.c index f01497d..c40c2e9 100644 --- a/user.c +++ b/user.c @@ -1,3 +1,10 @@ +#ifdef DEBUG +#ifdef __ANDROID__ +#include +#else +#include +#endif +#endif #include #include #include "post.h" @@ -187,13 +194,13 @@ static size_t show_handler(void *contents, size_t size, size_t nmemb } while ((line = strtok_r(NULL, "\n", &linesaveptr))); } else { #ifdef DEBUG -#ifdef ANDROID - __android_log_print(ANDROID_LOG_INFO, "librtclient" - , "%s response status:\n%s", __func__, line); +#ifdef __ANDROID__ + __android_log_print(ANDROID_LOG_INFO, "librtclient", + "%s response status:\n%s", __func__, line); #else printf("%s response status:\n%s\n", __func__, line); -#endif // ANDROID -#endif // DEBUG +#endif +#endif } return realsize; -- cgit v1.2.3