20 #ifndef _TORCS_PORTABILITY_H_ 21 #define _TORCS_PORTABILITY_H_ 39 static char *
strndup(
const char *str,
int len)
43 if ((str == NULL || len < 0)) {
47 ret = (
char *) malloc(len + 1);
52 memcpy(ret, str, len);
64 #define snprintf _snprintf 68 #define vsnprintf _vsnprintf 75 #if _MSC_VER < 1800 // VS2013 (_MSC_VER=1800) and later have round() 76 static float round(
float x)
83 #endif // _TORCS_PORTABILITY_H_ static char * strndup(const char *str, int len)