Added a [libui] and a newline to the message printed by complain().

This commit is contained in:
Pietro Gagliardi 2015-05-07 19:34:45 -04:00
parent 7a78825378
commit 34f55321e0
4 changed files with 7 additions and 5 deletions

View File

@ -1,5 +1,3 @@
- make sure complain()s don't have \n at the end; add one on each platform
- add a `[libui]` to the beginning of the message
- figure out what to do on Windows and GTK+ if we don't have menus but the user wants a menubar (zero-height widget? don't bother? complain?) - figure out what to do on Windows and GTK+ if we don't have menus but the user wants a menubar (zero-height widget? don't bother? complain?)
- bin.c - bin.c
- find a way to consolidate the duplicate code across OSs - find a way to consolidate the duplicate code across OSs

View File

@ -24,7 +24,9 @@ void complain(const char *fmt, ...)
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
fprintf(stderr, "[libui] ");
vfprintf(stderr, fmt, ap); vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap); va_end(ap);
abort(); abort();
} }

View File

@ -4,10 +4,10 @@
void complain(const char *fmt, ...) void complain(const char *fmt, ...)
{ {
va_list ap; va_list ap;
char *msg;
va_start(ap, fmt); va_start(ap, fmt);
// there's no g_errorv() in glib 2.32, so do it manually instead msg = g_strdup_vprintf(fmt, ap);
g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, fmt, ap);
va_end(ap); va_end(ap);
abort(); // just in case g_error("[libui] %s\n", msg);
} }

View File

@ -78,7 +78,9 @@ void complain(const char *fmt, ...)
va_list ap; va_list ap;
va_start(ap, fmt); va_start(ap, fmt);
fprintf(stderr, "[libui] ");
vfprintf(stderr, fmt, ap); vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap); va_end(ap);
abort(); abort();
} }