Просмотр исходного кода

Merge pull request #69 from xiangxistu/master

[fix] the bug of redeclare when "timeval" is defined by lwip oneself.
ChenYong 5 лет назад
Родитель
Сommit
0bc8d09c70
1 измененных файлов с 5 добавлено и 3 удалено
  1. 5 3
      src/webclient.c

+ 5 - 3
src/webclient.c

@@ -19,10 +19,12 @@
 #include <string.h>
 #include <ctype.h>
 
-#include <sys/time.h>
-
 #include <webclient.h>
 
+#if defined(RT_USING_LIBC) || defined(RT_USING_MINILIBC) || defined(RT_LIBC_USING_TIME)
+#include <sys/time.h>
+#endif
+
 /* support both enable and disable "SAL_USING_POSIX" */
 #if defined(RT_USING_SAL)
 #include <netdb.h>
@@ -1619,7 +1621,7 @@ int webclient_request(const char *URI, const char *header, const void *post_data
         return -WEBCLIENT_ERROR;
     }
 
-    if ((response != RT_NULL && resp_len == RT_NULL) || 
+    if ((response != RT_NULL && resp_len == RT_NULL) ||
         (response == RT_NULL && resp_len != RT_NULL))
     {
         LOG_E("input response data or length failed");