2001-12-10 Michael Meeks <michael@ximian.com>
[platform/core/uifw/at-spi2-atk.git] / cspi / spi-util.c
1 #include <stdlib.h>
2 #include <cspi/spi-private.h>
3
4 /**
5  * SPI_freeString:
6  * @s: a character string returned from another at-spi call.
7  *
8  * Free a character string returned from an at-spi call.  Clients of
9  * at-spi should use this function instead of free () or g_free().
10  * This API should not be used to free strings
11  * from other libraries or allocated by the client.
12  **/
13 void
14 SPI_freeString (char *s)
15 {
16   CORBA_free (s);
17 }
18
19 SPIBoolean
20 cspi_check_ev (const char *error_string)
21 {
22   CORBA_Environment *ev = cspi_ev ();
23
24   if (ev->_major != CORBA_NO_EXCEPTION)
25     {
26       char *err;
27
28       err = bonobo_exception_get_text (ev);
29
30       fprintf (stderr, "Warning: AT-SPI error: %s: %s\n",
31                error_string, err);
32
33       g_free (err);
34
35       CORBA_exception_free (ev);
36
37       return FALSE;
38     }
39   else
40     {
41       return TRUE;
42     }
43 }