util: added strtok_r implementation for old compilers

Visual studios older than 2005 don't have strtok_s() and according to
MSDN vs2005 has NOT thread-safe strtok().
This commit is contained in:
Dmitry Podgorny
2016-09-04 00:20:23 +03:00
parent 2b249130c9
commit 53e44aa0e3
3 changed files with 35 additions and 3 deletions

View File

@@ -24,10 +24,17 @@
#include "sha1.h"
#include "scram.h"
#include "rand.h"
#include "util.h"
#ifdef _WIN32
#define strtok_r strtok_s
#endif
/* strtok_s() has appeared in visual studio 2005.
Use own implementation for older versions. */
#ifdef _MSC_VER
# if (_MSC_VER >= 1400)
# define strtok_r strtok_s
# else
# define strtok_r xmpp_strtok_r
# endif
#endif /* _MSC_VER */
/** generate authentication string for the SASL PLAIN mechanism */