Imported Upstream version 3.3.3
[debian/amanda] / perl / amglue / gerror.c
1 /*
2  * Copyright (c) Zmanda, Inc.  All Rights Reserved.
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
12  * License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation,
16  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
17  *
18  * Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
19  * Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
20  */
21
22 #include "amglue.h"
23
24 void
25 croak_gerror(const char *domain, GError **error)
26 {
27     static char *errstr = NULL;
28     g_free(errstr);
29     if (error) {
30         errstr = g_strdup((*error)->message);
31         g_clear_error(error);
32         croak("%s: %s", domain, errstr);
33     }
34 }