Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use re-entrant version of strtok(), i.e. strtok_r(), to get tokens #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

brchiu
Copy link

@brchiu brchiu commented Jan 25, 2016

Use re-entrant version of strtok(), i.e. strtok_r(), to get tokens.

@brchiu
Copy link
Author

brchiu commented Jan 25, 2016

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().

@tavianator
Copy link
Contributor

I believe Windows does not have strtok_r, which is part of the reason I open-coded it in #45 instead.

@brchiu
Copy link
Author

brchiu commented Jan 25, 2016

@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().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants