]> git.cworth.org Git - apitrace/blobdiff - common/os.hpp
glretrace: GLX and WGL support for ES2/EGL traces.
[apitrace] / common / os.hpp
index 6a3b8c82f33840929b688de60ceb6f69fe9901b7..741d345bf18b30d1c702a1770db3e245f7276611 100644 (file)
 #ifndef vsnprintf
 #define vsnprintf _vsnprintf
 #endif
+#ifndef strcasecmp
+#define strcasecmp stricmp
+#endif
 #endif /* !_WIN32 */
 
 namespace os {
 
-void acquireMutex(void);
-
-void releaseMutex(void);
-
 void log(const char *format, ...)
 #ifdef __GNUC__
     __attribute__ ((format (printf, 1, 2)))
@@ -75,15 +74,28 @@ void log(const char *format, ...)
 #endif
 
 /**
- * Get the current time in microseconds from an unknown base.
+ * Exit immediately.
+ *
+ * This should be called only from the wrappers, when there is no safe way of
+ * failing gracefully.
  */
-long long getTime(void);
-
 void abort(void);
 
 void setExceptionCallback(void (*callback)(void));
 void resetExceptionCallback(void);
 
+/**
+ * Returns a pseudo-random integer in the range 0 to RAND_MAX.
+ */
+static inline int
+random(void) {
+#ifdef _WIN32
+    return ::rand();
+#else
+    return ::random();
+#endif
+}
+
 } /* namespace os */
 
 #endif /* _OS_HPP_ */