diff --git a/redo/windows/GNUmakeinc.mk b/redo/windows/GNUmakeinc.mk index 11064eab..790a795e 100644 --- a/redo/windows/GNUmakeinc.mk +++ b/redo/windows/GNUmakeinc.mk @@ -15,7 +15,6 @@ osCFILES = \ windows/group.c \ windows/init.c \ windows/label.c \ - windows/logging.c \ windows/main.c \ windows/menu.c \ windows/parent.c \ diff --git a/redo/windows/logging.c b/redo/windows/logging.c deleted file mode 100644 index e9bd0059..00000000 --- a/redo/windows/logging.c +++ /dev/null @@ -1,58 +0,0 @@ -// 9 june 2015 -#include "uipriv_windows.h" - -// We can't use the private heap for these functions, since they are allowed to be run before uiInit() or after uiUninit(). - -static void nomemlog(void) -{ - OutputDebugStringW(L"[libui] memory exhausted logging message"); - DebugBreak(); - abort(); // just in case -} - -void uiLog(const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - uiLogv(format, ap); - va_end(ap); -} - -void uiLogv(const char *format, va_list ap) -{ - va_list ap2; - int n; - char *buf; - - va_copy(ap2, ap); - n = _vscprintf(format, ap2); - va_end(ap2); - // "[libui] message\0" == (8 + n + 1) - buf = (char *) malloc((8 + n + 1) - if (buf == NULL) - nomemlog(); - buf[0] = '['; - buf[1] = 'l'; - buf[2] = 'i'; - buf[3] = 'b'; - buf[4] = 'u'; - buf[5] = 'i'; - buf[6] = ']'; - buf[7] = ' '; - vsnprintf_s(buf + 8, n + 1, n, format, ap); - // breaking the rules: we can't reliably tell that the encoding of debugging messages is UTF-8 like we could with everything else :/ - OutputDebugStringA(buf); - free(buf); -} - -void complain(const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - uiLogv(format, av); - va_end(ap); - DebugBreak(); - abort(); // just in case -} diff --git a/redo/windows/util.c b/redo/windows/util.c index 082c9143..eb5a0e30 100644 --- a/redo/windows/util.c +++ b/redo/windows/util.c @@ -34,6 +34,19 @@ int windowClassOf(HWND hwnd, ...) return -1; } +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); + DebugBreak(); + abort(); // just in case +} + // wrapper around MapWindowRect() that handles the complex error handling void mapWindowRect(HWND from, HWND to, RECT *r) {