xref: /reactos/sdk/lib/ucrt/string/wcstok.cpp (revision 04e0dc4a)
1 //
2 // wcstok.cpp
3 //
4 //      Copyright (c) Microsoft Corporation.  All rights reserved.
5 //
6 // Defines wcstok(), which tokenizes a string via repeated calls.  See strtok()
7 // for more details.
8 //
9 #include <corecrt_internal.h>
10 #include <string.h>
11 
12 
13 
14 _Check_return_
15 extern "C" wchar_t* __cdecl __acrt_wcstok_s_novalidation(
16     _Inout_opt_z_                 wchar_t*       string,
17     _In_z_                        wchar_t const* control,
18     _Inout_ _Deref_prepost_opt_z_ wchar_t**      context
19     );
20 
21 
22 
wcstok(wchar_t * const string,wchar_t const * const control,wchar_t ** const context)23 extern "C" wchar_t* __cdecl wcstok(
24     wchar_t*       const string,
25     wchar_t const* const control,
26     wchar_t**      const context
27     )
28 {
29     wchar_t** const context_to_use = context != nullptr
30         ? context
31         : &__acrt_getptd()->_wcstok_token;
32 
33     return __acrt_wcstok_s_novalidation(string, control, context_to_use);
34 }
35