Replace all usage of non-reentrant strtok() with strtok_r()

This commit is contained in:
Ondřej Surý
2018-03-21 21:16:51 +00:00
parent 921d05ddcf
commit 11f26b42e3
8 changed files with 37 additions and 56 deletions

View File

@@ -31,14 +31,6 @@
#include "driver.h"
#ifdef WIN32
#define STRTOK_R(a, b, c) strtok_s(a, b, c)
#elif defined(_REENTRANT)
#define STRTOK_R(a, b, c) strtok_r(a, b, c)
#else
#define STRTOK_R(a, b, c) strtok(a, b)
#endif
#define CHECK(x) \
do { \
result = (x); \
@@ -726,23 +718,23 @@ modrdataset(struct dlz_example_data *state, const char *name,
* for the type used by dig
*/
full_name = STRTOK_R(buf, "\t", &saveptr);
full_name = strtok_r(buf, "\t", &saveptr);
if (full_name == NULL)
goto error;
ttlstr = STRTOK_R(NULL, "\t", &saveptr);
ttlstr = strtok_r(NULL, "\t", &saveptr);
if (ttlstr == NULL)
goto error;
dclass = STRTOK_R(NULL, "\t", &saveptr);
dclass = strtok_r(NULL, "\t", &saveptr);
if (dclass == NULL)
goto error;
type = STRTOK_R(NULL, "\t", &saveptr);
type = strtok_r(NULL, "\t", &saveptr);
if (type == NULL)
goto error;
data = STRTOK_R(NULL, "\t", &saveptr);
data = strtok_r(NULL, "\t", &saveptr);
if (data == NULL)
goto error;