From d326407f05cadec6422fe3ccbcfcaf41a869dfde Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Fri, 10 Apr 2015 16:54:06 -0400 Subject: Decided to kill uiInitError and return the message as a const char * instead. Will need to implement on Windows. --- new/init_unix.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'new/init_unix.c') diff --git a/new/init_unix.c b/new/init_unix.c index 60abc91..b10c05b 100644 --- a/new/init_unix.c +++ b/new/init_unix.c @@ -1,31 +1,23 @@ // 6 april 2015 #include "uipriv_unix.h" -struct uiInitError { - GError *err; -}; - uiInitOptions options; -uiInitError *uiInit(uiInitOptions *o) +const char *uiInit(uiInitOptions *o) { - uiInitError *err; + GError *err = NULL; + const char *msg; options = *o; - err = uiNew(uiInitError); - if (gtk_init_with_args(NULL, NULL, NULL, NULL, NULL, &(err->err)) == FALSE) - return err; - uiFree(err); + if (gtk_init_with_args(NULL, NULL, NULL, NULL, NULL, &err) == FALSE) { + msg = g_strdup(err->message); + g_error_free(err); + return msg; + } return NULL; } -const char *uiInitErrorMessage(uiInitError *err) -{ - return err->err->message; -} - -void uiInitErrorFree(uiInitError *err) +void uiFreeInitError(const char *err) { - g_error_free(err->err); - uiFree(err); + g_free((gpointer) err); } -- cgit v1.2.3