Implement vasprintf and asprintf for platforms lacking them.

This commit is contained in:
Pierre-Antoine Lacaze
2012-01-09 09:44:58 +01:00
parent 86d88e9773
commit 002f27a30f
3 changed files with 35 additions and 40 deletions

9
util.h
View File

@@ -40,6 +40,9 @@
#define ISPC_UTIL_H
#include "ispc.h"
#ifdef ISPC_IS_WINDOWS
#include <stdarg.h>
#endif
struct SourcePos;
@@ -62,6 +65,12 @@ inline uint32_t RoundUpPow2(uint32_t v) {
#define PRINTF_FUNC
#endif // __GNUG__
// for cross-platform compatibility
#ifdef ISPC_IS_WINDOWS
int vasprintf(char **sptr, const char *fmt, va_list argv);
int asprintf(char **sptr, const char *fmt, ...);
#endif
/** Prints a debugging message. These messages are only printed if
g->debugPrint is \c true. In addition to a program source code
position to associate with the message, a printf()-style format string