2
* Copyright (C) 1999, 2000 Red Hat Inc.
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Library General Public
6
* License as published by the Free Software Foundation; either
7
* version 2 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Library General Public License for more details.
14
* You should have received a copy of the GNU Library General Public
15
* License along with this library; if not, write to the
16
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
* Boston, MA 02111-1307, USA.
20
#include "gconf-glib-public.h"
21
#include "gconf-glib-private.h"
25
g_error_new_valist(GQuark domain,
32
error = g_new (GError, 1);
34
error->domain = domain;
36
error->message = g_strdup_vprintf (format, args);
42
g_error_new (GQuark domain,
50
g_return_val_if_fail (format != NULL, NULL);
51
g_return_val_if_fail (domain != 0, NULL);
53
va_start (args, format);
54
error = g_error_new_valist (domain, code, format, args);
61
g_error_new_literal (GQuark domain,
67
g_return_val_if_fail (message != NULL, NULL);
68
g_return_val_if_fail (domain != 0, NULL);
70
err = g_new (GError, 1);
74
err->message = g_strdup (message);
80
g_error_free (GError *error)
82
g_return_if_fail (error != NULL);
84
g_free (error->message);
90
g_error_copy (const GError *error)
94
g_return_val_if_fail (error != NULL, NULL);
96
copy = g_new (GError, 1);
100
copy->message = g_strdup (error->message);
106
g_error_matches (const GError *error,
111
error->domain == domain &&
116
g_set_error (GError **err,
128
g_warning ("GError set over the top of a previous GError or uninitialized memory.\n"
129
"This indicates a bug in someone's code. You must ensure an error is NULL before it's set.");
131
va_start (args, format);
132
*err = g_error_new_valist (domain, code, format, args);
136
#define ERROR_OVERWRITTEN_WARNING "GError set over the top of a previous GError or uninitialized memory.\n" \
137
"This indicates a bug in someone's code. You must ensure an error is NULL before it's set."
141
* @dest: error return location
142
* @src: error to move into the return location
144
* If @dest is NULL, free @src; otherwise,
145
* moves @src into *@dest. *@dest must be NULL.
148
g_propagate_error (GError **dest,
151
g_return_if_fail (src != NULL);
162
g_warning (ERROR_OVERWRITTEN_WARNING);
169
g_clear_error (GError **err)