Fix compilation failure on Windows (#119)

* Fix compilation failure on Windows

* Fix lint
This commit is contained in:
Philip Hyunsu Cho 2019-10-15 23:37:42 +07:00 committed by GitHub
parent 8e2c201d23
commit 33dbc10aab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,9 +67,18 @@ const int kPrintBuffer = 1 << 12;
* co-locate in the same process */
extern bool STOP_PROCESS_ON_ERROR;
/* \brief Case-insensitive string comparison */
inline int CompareStringsCaseInsensitive(const char* s1, const char* s2) {
#ifdef _MSC_VER
return _stricmp(s1, s2);
#else // _MSC_VER
return strcasecmp(s1, s2);
#endif // _MSC_VER
}
/* \brief parse config string too bool*/
inline bool StringToBool(const char* s) {
return strcasecmp(s, "true") == 0 || atoi(s) != 0;
return CompareStringsCaseInsensitive(s, "true") == 0 || atoi(s) != 0;
}
#ifndef RABIT_CUSTOMIZE_MSG_