Added methods for Component Layer and MDI Z-Order information (see
[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_warn_ev (CORBA_Environment *ev, const char *error_string)
21 {
22   if (ev->_major != CORBA_NO_EXCEPTION)
23     {
24       char *err;
25
26       err = bonobo_exception_get_text (ev);
27
28       fprintf (stderr, "Warning: AT-SPI error: %s: %s\n",
29                error_string, err);
30
31       g_free (err);
32
33       CORBA_exception_free (ev);
34
35       return FALSE;
36     }
37   else
38     {
39       return TRUE;
40     }
41 }
42
43 void
44 cspi_check_ev (CORBA_Environment *ev, const char *error_string)
45 {
46   if (ev->_major != CORBA_NO_EXCEPTION)
47     {
48       char *err;
49
50       err = bonobo_exception_get_text (ev);
51
52       fprintf (stderr, "AT-SPI error: %s: %s\n",
53                error_string, err);
54
55       g_free (err);
56
57       CORBA_exception_free (ev);
58
59       exit (-1);
60     }
61 }