diff --git a/TODO.md b/TODO.md index 55f7ed30..6a33ea49 100644 --- a/TODO.md +++ b/TODO.md @@ -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?) - bin.c - find a way to consolidate the duplicate code across OSs diff --git a/darwin/util.m b/darwin/util.m index 7d331fb4..c7441461 100644 --- a/darwin/util.m +++ b/darwin/util.m @@ -24,7 +24,9 @@ void complain(const char *fmt, ...) va_list ap; va_start(ap, fmt); + fprintf(stderr, "[libui] "); vfprintf(stderr, fmt, ap); + fprintf(stderr, "\n"); va_end(ap); abort(); } diff --git a/unix/util.c b/unix/util.c index f02f4380..523d4cb2 100644 --- a/unix/util.c +++ b/unix/util.c @@ -4,10 +4,10 @@ void complain(const char *fmt, ...) { va_list ap; + char *msg; va_start(ap, fmt); - // there's no g_errorv() in glib 2.32, so do it manually instead - g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, fmt, ap); + msg = g_strdup_vprintf(fmt, ap); va_end(ap); - abort(); // just in case + g_error("[libui] %s\n", msg); } diff --git a/windows/util.c b/windows/util.c index eae4d0fb..c8705450 100644 --- a/windows/util.c +++ b/windows/util.c @@ -78,7 +78,9 @@ void complain(const char *fmt, ...) va_list ap; va_start(ap, fmt); + fprintf(stderr, "[libui] "); vfprintf(stderr, fmt, ap); + fprintf(stderr, "\n"); va_end(ap); abort(); }