Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
2ec3b961
Commit
2ec3b961
authored
Jan 14, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Make strtok and wcstok thread-safe by using the per-thread data.
parent
f9e5b0f5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
2 deletions
+46
-2
msvcrt.h
dlls/msvcrt/msvcrt.h
+2
-0
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+2
-2
string.c
dlls/msvcrt/string.c
+21
-0
wcs.c
dlls/msvcrt/wcs.c
+21
-0
No files found.
dlls/msvcrt/msvcrt.h
View file @
2ec3b961
...
...
@@ -93,7 +93,9 @@ extern DWORD msvcrt_tls_index;
struct
__thread_data
{
int
thread_errno
;
unsigned
long
thread_doserrno
;
char
*
strtok_next
;
/* next ptr for strtok() */
unsigned
char
*
mbstok_next
;
/* next ptr for mbstok() */
MSVCRT_wchar_t
*
wcstok_next
;
/* next ptr for wcstok() */
char
*
efcvt_buffer
;
/* buffer for ecvt/fcvt */
char
*
asctime_buffer
;
/* buffer for asctime */
MSVCRT_wchar_t
*
wasctime_buffer
;
/* buffer for wasctime */
...
...
dlls/msvcrt/msvcrt.spec
View file @
2ec3b961
...
...
@@ -714,7 +714,7 @@
@ cdecl strspn(str str)
@ cdecl strstr(str str)
@ cdecl strtod(str ptr)
@ cdecl strtok(str str)
@ cdecl strtok(str str)
MSVCRT_strtok
@ cdecl strtol(str ptr long)
@ cdecl strtoul(str ptr long)
@ cdecl strxfrm(ptr str long)
...
...
@@ -754,7 +754,7 @@
@ cdecl wcsspn(wstr wstr) ntdll.wcsspn
@ cdecl wcsstr(wstr wstr) ntdll.wcsstr
@ cdecl wcstod(wstr ptr) MSVCRT_wcstod
@ cdecl wcstok(wstr wstr)
ntdll.
wcstok
@ cdecl wcstok(wstr wstr)
MSVCRT_
wcstok
@ cdecl wcstol(wstr ptr long) ntdll.wcstol
@ cdecl wcstombs(ptr ptr long) ntdll.wcstombs
@ cdecl wcstoul(wstr ptr long) ntdll.wcstoul
...
...
dlls/msvcrt/string.c
View file @
2ec3b961
...
...
@@ -97,6 +97,27 @@ char* _strset(char* str, int value)
}
/*********************************************************************
* strtok (MSVCRT.@)
*/
char
*
MSVCRT_strtok
(
char
*
str
,
const
char
*
delim
)
{
thread_data_t
*
data
=
msvcrt_get_thread_data
();
char
*
ret
;
if
(
!
str
)
if
(
!
(
str
=
data
->
strtok_next
))
return
NULL
;
while
(
*
str
&&
strchr
(
delim
,
*
str
))
str
++
;
if
(
!*
str
)
return
NULL
;
ret
=
str
++
;
while
(
*
str
&&
!
strchr
(
delim
,
*
str
))
str
++
;
if
(
*
str
)
*
str
++
=
0
;
data
->
strtok_next
=
str
;
return
ret
;
}
/*********************************************************************
* _swab (MSVCRT.@)
*/
void
MSVCRT__swab
(
char
*
src
,
char
*
dst
,
int
len
)
...
...
dlls/msvcrt/wcs.c
View file @
2ec3b961
...
...
@@ -825,6 +825,27 @@ MSVCRT_wchar_t* MSVCRT_wcspbrk( const MSVCRT_wchar_t* str, const MSVCRT_wchar_t*
}
/*********************************************************************
* wcstok (MSVCRT.@)
*/
MSVCRT_wchar_t
*
MSVCRT_wcstok
(
MSVCRT_wchar_t
*
str
,
const
MSVCRT_wchar_t
*
delim
)
{
thread_data_t
*
data
=
msvcrt_get_thread_data
();
MSVCRT_wchar_t
*
ret
;
if
(
!
str
)
if
(
!
(
str
=
data
->
wcstok_next
))
return
NULL
;
while
(
*
str
&&
strchrW
(
delim
,
*
str
))
str
++
;
if
(
!*
str
)
return
NULL
;
ret
=
str
++
;
while
(
*
str
&&
!
strchrW
(
delim
,
*
str
))
str
++
;
if
(
*
str
)
*
str
++
=
0
;
data
->
wcstok_next
=
str
;
return
ret
;
}
/*********************************************************************
* wctomb (MSVCRT.@)
*/
INT
MSVCRT_wctomb
(
char
*
dst
,
MSVCRT_wchar_t
ch
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment