Open brchiu opened 8 years ago
Due to there are static variables used in files, changed to strtok_r() does not make the built library thread safe. There is another pull request #45 addressed this issue by totally removing strtok().
I believe Windows does not have strtok_r
, which is part of the reason I open-coded it in #45 instead.
@tavianator You are right, there is no strtok_r in Windows. However, there is strtok_s in Windows API having the same signature. So one way to resolve it is adding
#if defined(_WIN32) || defined(_WIN64)
#define strtok_r strtok_s
#endif
in certain header file to change it from strtok_r() to strtok_s().
Use re-entrant version of strtok(), i.e. strtok_r(), to get tokens.