[Mesa-dev] [PATCH] mesa: use strtok_s for strtok_r on windows

Tapani Pälli tapani.palli at intel.com
Wed Sep 30 10:33:46 PDT 2015


On 09/30/2015 04:06 PM, Brian Paul wrote:
> On 09/30/2015 12:19 AM, Tapani Pälli wrote:
>> https://msdn.microsoft.com/en-us/library/ftsafwz3.aspx
>>
>> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92183
>> ---
>>   src/mesa/main/imports.h | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
>> index d61279a..e0d818e 100644
>> --- a/src/mesa/main/imports.h
>> +++ b/src/mesa/main/imports.h
>> @@ -423,6 +423,9 @@ _mesa_vsnprintf(char *str, size_t size, const 
>> char *fmt, va_list arg);
>>   #define snprintf _snprintf
>>   #endif
>>
>> +#if defined(_MSC_VER) && !defined(strtok_r)
>> +#define strtok_r strtok_s
>> +#endif
>>
>>   #ifdef __cplusplus
>>   }
>>
>
> Actually, to make things work with MinGW also, I think it needs to be:
>
> #if defined(_WIN32) && !defined(strtok_r)
>
>
> That seems to get things building for me with MSVC and MinGW.
>

OK, I was not sure. I saw that there is _WIN64 as well so got scared of 
using _WIN32.

> -Brian
>



More information about the mesa-dev mailing list