Added proper platform checks for strtok_r
This commit is contained in:
parent
0d3d986c7b
commit
744eb31101
3 changed files with 9 additions and 9 deletions
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
include(CheckPrototypeDefinition)
|
include(CheckPrototypeDefinition)
|
||||||
include(CheckLibraryExists)
|
include(CheckLibraryExists)
|
||||||
|
include(CheckFunctionExists)
|
||||||
include(PackageUtils)
|
include(PackageUtils)
|
||||||
|
|
||||||
# Check for packages
|
# Check for packages
|
||||||
|
@ -21,12 +22,8 @@ cr_find_package (PCRE PKGCONFIG libpcre)
|
||||||
|
|
||||||
# Check for functions
|
# Check for functions
|
||||||
|
|
||||||
check_prototype_definition(
|
check_function_exists(strtok_s HAVE_STRTOK_S)
|
||||||
strtok_s
|
check_function_exists(strtok_r HAVE_STRTOK_R)
|
||||||
"char *strtok_s(char *strToken, const char *strDelimit, char **context)"
|
|
||||||
NULL
|
|
||||||
"string.h"
|
|
||||||
HAVE_STRTOK_S)
|
|
||||||
|
|
||||||
check_library_exists (rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
|
check_library_exists (rt clock_gettime "time.h" HAVE_CLOCK_GETTIME)
|
||||||
|
|
||||||
|
|
|
@ -27,12 +27,14 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
|
|
||||||
# ifdef VANILLA_WIN32
|
# ifdef VANILLA_WIN32
|
||||||
# if HAVE_STRTOK_S
|
# if !HAVE_STRTOK_R
|
||||||
# define strtok_r strtok_s
|
# if HAVE_STRTOK_S
|
||||||
# else
|
# define strtok_r strtok_s
|
||||||
|
# else
|
||||||
static CR_INLINE char *strtok_r(char *str, const char *delim, CR_UNUSED char **saveptr) {
|
static CR_INLINE char *strtok_r(char *str, const char *delim, CR_UNUSED char **saveptr) {
|
||||||
return strtok(str, delim);
|
return strtok(str, delim);
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#cmakedefine ENABLE_VALGRIND_ERRORS @ENABLE_VALGRIND_ERRORS@
|
#cmakedefine ENABLE_VALGRIND_ERRORS @ENABLE_VALGRIND_ERRORS@
|
||||||
#cmakedefine MINGW_DEFINE_OFF_T @MINGW_DEFINE_OFF_T@
|
#cmakedefine MINGW_DEFINE_OFF_T @MINGW_DEFINE_OFF_T@
|
||||||
#cmakedefine01 HAVE_STRTOK_S
|
#cmakedefine01 HAVE_STRTOK_S
|
||||||
|
#cmakedefine01 HAVE_STRTOK_R
|
||||||
|
|
||||||
# define LOCALEDIR "${LOCALEDIR}"
|
# define LOCALEDIR "${LOCALEDIR}"
|
||||||
# define PACKAGE "${PROJECT_NAME}"
|
# define PACKAGE "${PROJECT_NAME}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue