From 2189827287026b9bf247d99c2313af77d842df46 Mon Sep 17 00:00:00 2001 From: David Garske Date: Wed, 4 Apr 2018 10:41:14 -0700 Subject: [PATCH] Fix for issue with `wc_strtok` function declaration not being available because of include order. Fixes issue #1469. --- wolfssl/wolfcrypt/types.h | 14 +++++++++----- wolfssl/wolfcrypt/wc_port.h | 4 ---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index 61e958bbe..b073ca52c 100755 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -299,6 +299,10 @@ #ifndef WOLFSSL_LEANPSK char* mystrnstr(const char* s1, const char* s2, unsigned int n); #endif + #if !defined(USE_WOLF_STRTOK) && \ + (defined(__MINGW32__) || defined(WOLFSSL_TIRTOS)) + #define USE_WOLF_STRTOK + #endif #ifndef STRING_USER #include @@ -341,11 +345,7 @@ #if defined(WOLFSSL_CERT_EXT) || defined(HAVE_ALPN) /* use only Thread Safe version of strtok */ - #if defined(__MINGW32__) || defined(WOLFSSL_TIRTOS) || \ - defined(USE_WOLF_STRTOK) - #ifndef USE_WOLF_STRTOK - #define USE_WOLF_STRTOK - #endif + #if defined(USE_WOLF_STRTOK) #define XSTRTOK wc_strtok #elif defined(USE_WINDOWS_API) || defined(INTIME_RTOS) #define XSTRTOK strtok_s @@ -355,6 +355,10 @@ #endif #endif + #ifdef USE_WOLF_STRTOK + WOLFSSL_LOCAL char* wc_strtok(char *str, const char *delim, char **nextp); + #endif + #if !defined(NO_FILESYSTEM) && defined(OPENSSL_EXTRA) && \ !defined(NO_STDIO_FILESYSTEM) #ifndef XGETENV diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index c2d1e4585..c1cdd1ae0 100644 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -319,10 +319,6 @@ WOLFSSL_API int wolfCrypt_Cleanup(void); #endif /* !NO_FILESYSTEM */ -#ifdef USE_WOLF_STRTOK - WOLFSSL_LOCAL char* wc_strtok(char *str, const char *delim, char **nextp); -#endif - /* Windows API defines its own min() macro. */ #if defined(USE_WINDOWS_API) #if defined(min) || defined(WOLFSSL_MYSQL_COMPATIBLE)