Kick out strtok_r, all our platforms should have it (or strtok_s)
This commit is contained in:
parent
f45d61ef18
commit
72669df354
|
@ -77,6 +77,7 @@ macro( perform_feature_checks )
|
||||||
check_symbol_exists( strncasecmp "string.h" HAVE_STRNCASECMP )
|
check_symbol_exists( strncasecmp "string.h" HAVE_STRNCASECMP )
|
||||||
check_symbol_exists( strncasecmp "strings.h" HAVE_STRNCASECMP )
|
check_symbol_exists( strncasecmp "strings.h" HAVE_STRNCASECMP )
|
||||||
check_symbol_exists( strtok_r "string.h" HAVE_STRTOKR )
|
check_symbol_exists( strtok_r "string.h" HAVE_STRTOKR )
|
||||||
|
check_symbol_exists( strtok_s "string.h" HAVE_STRTOKS )
|
||||||
|
|
||||||
check_cxx_symbol_exists( strcasecmp "string.h" HAVE_STRCASECMP )
|
check_cxx_symbol_exists( strcasecmp "string.h" HAVE_STRCASECMP )
|
||||||
check_cxx_symbol_exists( strncasecmp "string.h" HAVE_STRNCASECMP )
|
check_cxx_symbol_exists( strncasecmp "string.h" HAVE_STRNCASECMP )
|
||||||
|
|
|
@ -7,7 +7,15 @@
|
||||||
|
|
||||||
#cmakedefine HAVE_STRNCASECMP
|
#cmakedefine HAVE_STRNCASECMP
|
||||||
|
|
||||||
|
#cmakedefine HAVE_STRTOKS
|
||||||
|
#ifdef HAVE_STRTOKS
|
||||||
|
// strtok_s is the actual C11 standard rather than posix strtok_r
|
||||||
|
// but its also an optional standard, MSVC supports it, so alias it
|
||||||
|
#define HAVE_STRTOKR
|
||||||
|
#define strtok_r strtok_s
|
||||||
|
#else
|
||||||
#cmakedefine HAVE_STRTOKR // spelled oddly to differ from wx's similar test
|
#cmakedefine HAVE_STRTOKR // spelled oddly to differ from wx's similar test
|
||||||
|
#endif
|
||||||
|
|
||||||
// Handle platform differences in math.h
|
// Handle platform differences in math.h
|
||||||
#cmakedefine HAVE_MATH_H
|
#cmakedefine HAVE_MATH_H
|
||||||
|
|
|
@ -412,10 +412,6 @@ if( TRUE OR NOT USE_KIWAY_DLLS )
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if( NOT HAVE_STRTOKR )
|
|
||||||
list( APPEND COMMON_SRCS strtok_r.c )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list( APPEND COMMON_SRCS
|
list( APPEND COMMON_SRCS
|
||||||
kicad_curl/kicad_curl.cpp
|
kicad_curl/kicad_curl.cpp
|
||||||
kicad_curl/kicad_curl_easy.cpp
|
kicad_curl/kicad_curl_easy.cpp
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
/*
|
|
||||||
* public domain strtok_r()
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
char* strtok_r( char* str, const char* delim, char** nextp )
|
|
||||||
{
|
|
||||||
char* ret;
|
|
||||||
|
|
||||||
if( str == NULL )
|
|
||||||
{
|
|
||||||
str = *nextp;
|
|
||||||
}
|
|
||||||
|
|
||||||
str += strspn( str, delim );
|
|
||||||
|
|
||||||
if( *str == '\0' )
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = str;
|
|
||||||
|
|
||||||
str += strcspn( str, delim );
|
|
||||||
|
|
||||||
if( *str )
|
|
||||||
{
|
|
||||||
*str++ = '\0';
|
|
||||||
}
|
|
||||||
|
|
||||||
*nextp = str;
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
|
@ -24,8 +24,6 @@
|
||||||
#ifndef STRING_UTILS_H
|
#ifndef STRING_UTILS_H
|
||||||
#define STRING_UTILS_H
|
#define STRING_UTILS_H
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
|
@ -230,11 +228,6 @@ wxString GetIllegalFileNameWxChars();
|
||||||
bool ReplaceIllegalFileNameChars( std::string* aName, int aReplaceChar = 0 );
|
bool ReplaceIllegalFileNameChars( std::string* aName, int aReplaceChar = 0 );
|
||||||
bool ReplaceIllegalFileNameChars( wxString& aName, int aReplaceChar = 0 );
|
bool ReplaceIllegalFileNameChars( wxString& aName, int aReplaceChar = 0 );
|
||||||
|
|
||||||
#ifndef HAVE_STRTOKR
|
|
||||||
// common/strtok_r.c optionally:
|
|
||||||
extern "C" char* strtok_r( char* str, const char* delim, char** nextp );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper for sorting strings from the rear.
|
* A helper for sorting strings from the rear.
|
||||||
|
|
Loading…
Reference in New Issue