+char *va(char *buf, size_t buflen, const char *format, ...) DP_FUNC_PRINTF(3);
+// does a varargs printf into provided buffer, returns buffer (so it can be called in-line unlike dpsnprintf)
+
+// GCC with -Werror=c++-compat will error out if static_assert is used even though the macro is valid C11...
+#ifndef __cplusplus
+#define DP_STATIC_ASSERT(expr, str) _Static_assert(expr, str)
+#else
+#define DP_STATIC_ASSERT(expr, str) static_assert(expr, str)
+#endif
+
+// snprintf and vsnprintf are NOT portable. Use their DP counterparts instead
+#ifdef snprintf
+# undef snprintf
+#endif
+#define snprintf DP_STATIC_ASSERT(0, "snprintf is forbidden for portability reasons. Use dpsnprintf instead.")
+#ifdef vsnprintf
+# undef vsnprintf
+#endif
+#define vsnprintf DP_STATIC_ASSERT(0, "vsnprintf is forbidden for portability reasons. Use dpvsnprintf instead.")
+
+// dpsnprintf and dpvsnprintf
+// return the number of printed characters, excluding the final '\0'
+// or return -1 if the buffer isn't big enough to contain the entire string.
+// buffer is ALWAYS null-terminated
+extern int dpsnprintf (char *buffer, size_t buffersize, const char *format, ...) DP_FUNC_PRINTF(3);
+extern int dpvsnprintf (char *buffer, size_t buffersize, const char *format, va_list args);
+
+// A bunch of functions are forbidden for security reasons (and also to please MSVS 2005, for some of them)
+// LadyHavoc: added #undef lines here to avoid warnings in Linux
+#undef strcat
+#define strcat DP_STATIC_ASSERT(0, "strcat is forbidden for security reasons. Use strlcat or memcpy instead.")
+#undef strncat
+#define strncat DP_STATIC_ASSERT(0, "strncat is forbidden for security reasons. Use strlcat or memcpy instead.")
+#undef strcpy
+#define strcpy DP_STATIC_ASSERT(0, "strcpy is forbidden for security reasons. Use strlcpy or memcpy instead.")
+#undef strncpy
+#define strncpy DP_STATIC_ASSERT(0, "strncpy is forbidden for security reasons. Use strlcpy or memcpy instead.")
+#undef sprintf
+#define sprintf DP_STATIC_ASSERT(0, "sprintf is forbidden for security reasons. Use dpsnprintf instead.")