Changed IDL for State, Component, and Image to reduce use of out params.
[platform/core/uifw/at-spi2-atk.git] / cspi / spi-util.c
index 2c89479..64a52be 100644 (file)
@@ -1,35 +1,61 @@
+#include <stdlib.h>
+#include <cspi/spi-private.h>
+
+/**
+ * SPI_freeString:
+ * @s: a character string returned from another at-spi call.
+ *
+ * Free a character string returned from an at-spi call.  Clients of
+ * at-spi should use this function instead of free () or g_free().
+ * This API should not be used to free strings
+ * from other libraries or allocated by the client.
+ **/
 void
-spi_freeString (char *s)
+SPI_freeString (char *s)
 {
   CORBA_free (s);
 }
 
-boolean
-spi_warn_ev (CORBA_Environment *c_ev, char *error_string) {
-
-  if (c_ev->_major != CORBA_NO_EXCEPTION) {
-    fprintf (stderr,
-            "Warning: AT-SPI error: %s: %s\n",
-            error_string,
-             CORBA_exception_id(c_ev));
-        CORBA_exception_init (c_ev);
-        return FALSE;
-  }
+SPIBoolean
+cspi_warn_ev (CORBA_Environment *ev, const char *error_string)
+{
+  if (ev->_major != CORBA_NO_EXCEPTION)
+    {
+      char *err;
+
+      err = bonobo_exception_get_text (ev);
+
+      fprintf (stderr, "Warning: AT-SPI error: %s: %s\n",
+              error_string, err);
+
+      g_free (err);
+
+      CORBA_exception_free (ev);
+
+      return FALSE;
+    }
   else
-  {
-        return TRUE;
-  }
+    {
+      return TRUE;
+    }
 }
 
 void
-spi_check_ev (CORBA_Environment *c_ev, char *error_string) {
-
-  if (c_ev->_major != CORBA_NO_EXCEPTION) {
-    fprintf (stderr,
-            ("AT-SPI error: %s: %s\n"),
-            error_string,
-            CORBA_exception_id(c_ev));
-    CORBA_exception_free(c_ev);
-    exit(-1);
-  }
+cspi_check_ev (CORBA_Environment *ev, const char *error_string)
+{
+  if (ev->_major != CORBA_NO_EXCEPTION)
+    {
+      char *err;
+
+      err = bonobo_exception_get_text (ev);
+
+      fprintf (stderr, "AT-SPI error: %s: %s\n",
+              error_string, err);
+
+      g_free (err);
+
+      CORBA_exception_free (ev);
+
+      exit (-1);
+    }
 }