mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-15 08:03:50 +00:00
8345589: Simplify Windows definition of strtok_r
Reviewed-by: dholmes, jwaters
This commit is contained in:
parent
153dc6d843
commit
e821d599c8
@ -28,8 +28,9 @@
|
||||
#include "jvm_md.h"
|
||||
#include "runtime/osInfo.hpp"
|
||||
#include "utilities/exceptions.hpp"
|
||||
#include "utilities/ostream.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
#include "utilities/ostream.hpp"
|
||||
#ifdef __APPLE__
|
||||
# include <mach/mach_time.h>
|
||||
#endif
|
||||
@ -1027,14 +1028,6 @@ class os: AllStatic {
|
||||
class Posix;
|
||||
#endif
|
||||
|
||||
// FIXME - some random stuff that was in os_windows.hpp
|
||||
#ifdef _WINDOWS
|
||||
// strtok_s is the Windows thread-safe equivalent of POSIX strtok_r
|
||||
# define strtok_r strtok_s
|
||||
# define S_ISCHR(mode) (((mode) & _S_IFCHR) == _S_IFCHR)
|
||||
# define S_ISFIFO(mode) (((mode) & _S_IFIFO) == _S_IFIFO)
|
||||
#endif
|
||||
|
||||
#ifndef OS_NATIVE_THREAD_CREATION_FAILED_MSG
|
||||
#define OS_NATIVE_THREAD_CREATION_FAILED_MSG "unable to create native thread: possibly out of memory or process/resource limits reached"
|
||||
#endif
|
||||
|
||||
@ -37,6 +37,7 @@
|
||||
# include <stdlib.h>
|
||||
# include <stdint.h>
|
||||
# include <stddef.h>// for offsetof
|
||||
# include <sys/stat.h>
|
||||
# include <io.h> // for stream.cpp
|
||||
# include <float.h> // for _isnan
|
||||
# include <stdio.h> // for va_list
|
||||
@ -80,6 +81,18 @@ inline int strncasecmp(const char *s1, const char *s2, size_t n) {
|
||||
return _strnicmp(s1,s2,n);
|
||||
}
|
||||
|
||||
// VS doesn't provide strtok_r, which is a POSIX function. Instead, it
|
||||
// provides the same function under the name strtok_s. Note that this is
|
||||
// *not* the same as the C99 Annex K strtok_s. VS provides that function
|
||||
// under the name strtok_s_l. Make strtok_r a synonym so we can use that name
|
||||
// in shared code.
|
||||
const auto strtok_r = strtok_s;
|
||||
|
||||
// VS doesn't provide POSIX macros S_ISFIFO or S_IFIFO. It doesn't even
|
||||
// provide _S_ISFIFO, per its usual naming convention for POSIX stuff. But it
|
||||
// does provide _S_IFIFO, so we can roll our own S_ISFIFO.
|
||||
#define S_ISFIFO(mode) (((mode) & _S_IFIFO) == _S_IFIFO)
|
||||
|
||||
// Checking for nanness
|
||||
|
||||
inline int g_isnan(jfloat f) { return _isnan(f); }
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user