summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Wilhelmi <wilhelmi@ira.uka.de>2000-09-01 12:47:42 +0000
committerSebastian Wilhelmi <wilhelmi@src.gnome.org>2000-09-01 12:47:42 +0000
commit21a498b1a54aa59bd0a3c4e6985307ec326683d2 (patch)
treeba4a2f5255409165e01c5cecf0df29d9d5a9257e
parent3dcf39eb77dc324b6838a87fa82fb6d10a208cf7 (diff)
downloadglib-21a498b1a54aa59bd0a3c4e6985307ec326683d2.tar.gz
Added function g_propagte_error to hand over local errors to the calling
2000-09-01 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * gerror.c, gerror.h (g_propagte_error): Added function g_propagte_error to hand over local errors to the calling function.
-rw-r--r--ChangeLog6
-rw-r--r--ChangeLog.pre-2-06
-rw-r--r--ChangeLog.pre-2-106
-rw-r--r--ChangeLog.pre-2-126
-rw-r--r--ChangeLog.pre-2-26
-rw-r--r--ChangeLog.pre-2-46
-rw-r--r--ChangeLog.pre-2-66
-rw-r--r--ChangeLog.pre-2-86
-rw-r--r--gerror.c29
-rw-r--r--gerror.h5
-rw-r--r--glib/gerror.c29
-rw-r--r--glib/gerror.h5
12 files changed, 104 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 1abba36cf..17a9a7adb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-09-01 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gerror.c, gerror.h (g_propagte_error): Added function
+ g_propagte_error to hand over local errors to the calling
+ function.
+
2000-08-31 Tor Lillqvist <tml@iki.fi>
* glib.h
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 1abba36cf..17a9a7adb 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,9 @@
+2000-09-01 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gerror.c, gerror.h (g_propagte_error): Added function
+ g_propagte_error to hand over local errors to the calling
+ function.
+
2000-08-31 Tor Lillqvist <tml@iki.fi>
* glib.h
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 1abba36cf..17a9a7adb 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,9 @@
+2000-09-01 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gerror.c, gerror.h (g_propagte_error): Added function
+ g_propagte_error to hand over local errors to the calling
+ function.
+
2000-08-31 Tor Lillqvist <tml@iki.fi>
* glib.h
diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12
index 1abba36cf..17a9a7adb 100644
--- a/ChangeLog.pre-2-12
+++ b/ChangeLog.pre-2-12
@@ -1,3 +1,9 @@
+2000-09-01 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gerror.c, gerror.h (g_propagte_error): Added function
+ g_propagte_error to hand over local errors to the calling
+ function.
+
2000-08-31 Tor Lillqvist <tml@iki.fi>
* glib.h
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 1abba36cf..17a9a7adb 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,9 @@
+2000-09-01 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gerror.c, gerror.h (g_propagte_error): Added function
+ g_propagte_error to hand over local errors to the calling
+ function.
+
2000-08-31 Tor Lillqvist <tml@iki.fi>
* glib.h
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 1abba36cf..17a9a7adb 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,9 @@
+2000-09-01 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gerror.c, gerror.h (g_propagte_error): Added function
+ g_propagte_error to hand over local errors to the calling
+ function.
+
2000-08-31 Tor Lillqvist <tml@iki.fi>
* glib.h
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 1abba36cf..17a9a7adb 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,9 @@
+2000-09-01 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gerror.c, gerror.h (g_propagte_error): Added function
+ g_propagte_error to hand over local errors to the calling
+ function.
+
2000-08-31 Tor Lillqvist <tml@iki.fi>
* glib.h
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 1abba36cf..17a9a7adb 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,9 @@
+2000-09-01 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
+
+ * gerror.c, gerror.h (g_propagte_error): Added function
+ g_propagte_error to hand over local errors to the calling
+ function.
+
2000-08-31 Tor Lillqvist <tml@iki.fi>
* glib.h
diff --git a/gerror.c b/gerror.c
index 0a1a4dbc3..17baf19eb 100644
--- a/gerror.c
+++ b/gerror.c
@@ -117,11 +117,14 @@ g_error_matches (const GError *error,
error->code == code;
}
+#define ERROR_OVERWRITTEN_WARNING "GError set over the top of a previous GError or uninitialized memory.\n" \
+ "This indicates a bug in someone's code. You must ensure an error is NULL before it's set."
+
void
-g_set_error (GError **err,
- GQuark domain,
- gint code,
- const gchar *format,
+g_set_error (GError **err,
+ GQuark domain,
+ gint code,
+ const gchar *format,
...)
{
va_list args;
@@ -130,14 +133,28 @@ g_set_error (GError **err,
return;
if (*err != NULL)
- g_warning ("GError set over the top of a previous GError or uninitialized memory.\n"
- "This indicates a bug in someone's code. You must ensure an error is NULL before it's set.");
+ g_warning (ERROR_OVERWRITTEN_WARNING);
va_start (args, format);
*err = g_error_new_valist (domain, code, format, args);
va_end (args);
}
+void
+g_propagate_error (GError **dest,
+ GError *src)
+{
+ g_return_if_fail (src != NULL);
+
+ if (dest == NULL)
+ return;
+
+ if (*dest != NULL)
+ g_warning (ERROR_OVERWRITTEN_WARNING);
+
+ *dest = src;
+}
+
void
g_clear_error (GError **err)
{
diff --git a/gerror.h b/gerror.h
index 7eafa94c2..458c20a7d 100644
--- a/gerror.h
+++ b/gerror.h
@@ -60,6 +60,11 @@ void g_set_error (GError **err,
const gchar *format,
...) G_GNUC_PRINTF (4, 5);
+/* if (dest) *dest = src; also has some sanity checks.
+ */
+void g_propagate_error (GError **dest,
+ GError *src);
+
/* if (err && *err) { g_error_free(*err); *err = NULL; } */
void g_clear_error (GError **err);
diff --git a/glib/gerror.c b/glib/gerror.c
index 0a1a4dbc3..17baf19eb 100644
--- a/glib/gerror.c
+++ b/glib/gerror.c
@@ -117,11 +117,14 @@ g_error_matches (const GError *error,
error->code == code;
}
+#define ERROR_OVERWRITTEN_WARNING "GError set over the top of a previous GError or uninitialized memory.\n" \
+ "This indicates a bug in someone's code. You must ensure an error is NULL before it's set."
+
void
-g_set_error (GError **err,
- GQuark domain,
- gint code,
- const gchar *format,
+g_set_error (GError **err,
+ GQuark domain,
+ gint code,
+ const gchar *format,
...)
{
va_list args;
@@ -130,14 +133,28 @@ g_set_error (GError **err,
return;
if (*err != NULL)
- g_warning ("GError set over the top of a previous GError or uninitialized memory.\n"
- "This indicates a bug in someone's code. You must ensure an error is NULL before it's set.");
+ g_warning (ERROR_OVERWRITTEN_WARNING);
va_start (args, format);
*err = g_error_new_valist (domain, code, format, args);
va_end (args);
}
+void
+g_propagate_error (GError **dest,
+ GError *src)
+{
+ g_return_if_fail (src != NULL);
+
+ if (dest == NULL)
+ return;
+
+ if (*dest != NULL)
+ g_warning (ERROR_OVERWRITTEN_WARNING);
+
+ *dest = src;
+}
+
void
g_clear_error (GError **err)
{
diff --git a/glib/gerror.h b/glib/gerror.h
index 7eafa94c2..458c20a7d 100644
--- a/glib/gerror.h
+++ b/glib/gerror.h
@@ -60,6 +60,11 @@ void g_set_error (GError **err,
const gchar *format,
...) G_GNUC_PRINTF (4, 5);
+/* if (dest) *dest = src; also has some sanity checks.
+ */
+void g_propagate_error (GError **dest,
+ GError *src);
+
/* if (err && *err) { g_error_free(*err); *err = NULL; } */
void g_clear_error (GError **err);