summaryrefslogtreecommitdiff
path: root/glib/gerror.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2000-09-06 23:30:21 +0000
committerHavoc Pennington <hp@src.gnome.org>2000-09-06 23:30:21 +0000
commit29b652941cace1f94b561b0c27b2c71200b57aa4 (patch)
tree1fdb72928862da4a14b232c8f8639426825f4455 /glib/gerror.c
parent98dbc6a7108fffb40c077e4727bec3123c132af5 (diff)
downloadglib-29b652941cace1f94b561b0c27b2c71200b57aa4.tar.gz
docs
2000-09-06 Havoc Pennington <hp@redhat.com> * gerror.c: docs * docs/reference/glib/tmpl/error_reporting.sgml: docs
Diffstat (limited to 'glib/gerror.c')
-rw-r--r--glib/gerror.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/glib/gerror.c b/glib/gerror.c
index 17baf19eb..1a032e73e 100644
--- a/glib/gerror.c
+++ b/glib/gerror.c
@@ -43,6 +43,18 @@ g_error_new_valist(GQuark domain,
return error;
}
+/**
+ * g_error_new:
+ * @domain: error domain
+ * @code: error code
+ * @format: printf()-style format for error message
+ * @Varargs: parameters for message format
+ *
+ * Creates a new #GError with the given @domain and @code,
+ * and a message formatted with @format.
+ *
+ * Return value: a new #GError
+ **/
GError*
g_error_new (GQuark domain,
gint code,
@@ -62,6 +74,19 @@ g_error_new (GQuark domain,
return error;
}
+/**
+ * g_error_new_literal:
+ * @domain: error domain
+ * @code: error code
+ * @message: error message
+ *
+ * Creates a new #GError; unlike g_error_new(), @message is not
+ * a printf()-style format string. Use this function if @message
+ * contains text you don't have control over, that could include
+ * printf() escape sequences.
+ *
+ * Return value: a new #GError
+ **/
GError*
g_error_new_literal (GQuark domain,
gint code,
@@ -81,6 +106,13 @@ g_error_new_literal (GQuark domain,
return err;
}
+/**
+ * g_error_free:
+ * @error: a #GError
+ *
+ * Frees a #GError and associated resources.
+ *
+ **/
void
g_error_free (GError *error)
{
@@ -91,6 +123,14 @@ g_error_free (GError *error)
g_free (error);
}
+/**
+ * g_error_copy:
+ * @error: a #GError
+ *
+ * Makes a copy of @error.
+ *
+ * Return value: a new #GError
+ **/
GError*
g_error_copy (const GError *error)
{
@@ -107,6 +147,17 @@ g_error_copy (const GError *error)
return copy;
}
+/**
+ * g_error_matches:
+ * @error: a #GError
+ * @domain: an error domain
+ * @code: an error code
+ *
+ * Returns TRUE if @error matches @domain and @code, FALSE
+ * otherwise.
+ *
+ * Return value: whether @error has @domain and @code
+ **/
gboolean
g_error_matches (const GError *error,
GQuark domain,
@@ -120,6 +171,17 @@ g_error_matches (const GError *error,
#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."
+/**
+ * g_set_error:
+ * @err: a return location for a #GError, or NULL
+ * @domain: error domain
+ * @code: error code
+ * @format: printf()-style format
+ * @Varargs: args for @format
+ *
+ * Does nothing if @err is NULL; if @err is non-NULL, then *@err must
+ * be NULL. A new #GError is created and assigned to *@err.
+ **/
void
g_set_error (GError **err,
GQuark domain,
@@ -140,6 +202,14 @@ g_set_error (GError **err,
va_end (args);
}
+/**
+ * g_propagate_error:
+ * @dest: error return location
+ * @src: error to move into the return location
+ *
+ * Does nothing if @dest is NULL; otherwise,
+ * moves @src into *@dest. *@dest must be NULL.
+ **/
void
g_propagate_error (GError **dest,
GError *src)
@@ -155,6 +225,13 @@ g_propagate_error (GError **dest,
*dest = src;
}
+/**
+ * g_clear_error:
+ * @err: a #GError return location
+ *
+ * If @err is NULL, does nothing. If @err is non-NULL,
+ * calls g_error_free() on *@err and sets *@err to NULL.
+ **/
void
g_clear_error (GError **err)
{