Simplify al_print

This commit is contained in:
Chris Robinson
2019-06-18 22:57:48 -07:00
parent 706df72d18
commit 0fa984027c
2 changed files with 8 additions and 9 deletions
+6 -7
View File
@@ -477,7 +477,7 @@ void *GetSymbol(void *handle, const char *name)
}
void al_print(const char *type, const char *fmt, ...)
void al_print(FILE *logfile, const char *fmt, ...)
{
al::vector<char> dynmsg;
char stcmsg[256];
@@ -497,8 +497,8 @@ void al_print(const char *type, const char *fmt, ...)
va_end(args);
std::wstring wstr{utf8_to_wstr(str)};
fprintf(gLogFile, "AL lib: %s %ls", type, wstr.c_str());
fflush(gLogFile);
fprintf(logfile, "%ls", wstr.c_str());
fflush(logfile);
}
@@ -713,16 +713,15 @@ void *GetSymbol(void *handle, const char *name)
#endif /* HAVE_DLFCN_H */
void al_print(const char *type, const char *fmt, ...)
void al_print(FILE *logfile, const char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
fprintf(gLogFile, "AL lib: %s ", type);
vfprintf(gLogFile, fmt, ap);
vfprintf(logfile, fmt, ap);
va_end(ap);
fflush(gLogFile);
fflush(logfile);
}
+2 -2
View File
@@ -15,11 +15,11 @@
extern FILE *gLogFile;
void al_print(FILE *logfile, const char *fmt, ...) DECL_FORMAT(printf, 2,3);
#if !defined(_WIN32)
#define AL_PRINT(T, ...) fprintf(gLogFile, "AL lib: " T " " __VA_ARGS__)
#else
void al_print(const char *type, const char *fmt, ...) DECL_FORMAT(printf, 2,3);
#define AL_PRINT(T, ...) al_print((T), __VA_ARGS__)
#define AL_PRINT(T, ...) al_print(gLogFile, "AL lib: " T " " __VA_ARGS__)
#endif
#ifdef __ANDROID__