[gmime] Added g_mime_references_copy and registered GMimeReferences as a boxed type
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Added g_mime_references_copy and registered GMimeReferences as a boxed type
- Date: Sun, 12 Feb 2017 16:01:24 +0000 (UTC)
commit 38e16ee6701750658a0f6157b1b9f8f702075357
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date: Sun Feb 12 11:00:24 2017 -0500
Added g_mime_references_copy and registered GMimeReferences as a boxed type
gmime/gmime-utils.c | 33 +++++++++++++++++++++++++++++++++
gmime/gmime-utils.h | 1 +
gmime/gmime.c | 4 ++++
3 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/gmime/gmime-utils.c b/gmime/gmime-utils.c
index b7f413d..eb0d1f0 100644
--- a/gmime/gmime-utils.c
+++ b/gmime/gmime-utils.c
@@ -1055,6 +1055,39 @@ g_mime_references_decode (const char *text)
/**
+ * g_mime_references_copy:
+ * @references: the list of references to copy
+ *
+ * Copies a #GMimeReferences linked list.
+ *
+ * Returns: a newly allocated linked list that contains
+ * an identical list of items as @references.
+ **/
+GMimeReferences *
+g_mime_references_copy (GMimeReferences *references)
+{
+ GMimeReferences *ref, *node, *copy = NULL;
+
+ ref = references;
+ while (ref != NULL) {
+ if (copy == NULL) {
+ copy = node = g_new (GMimeReferences, 1);
+ } else {
+ node->next = g_new (GMimeReferences, 1);
+ node = node->next;
+ }
+
+ node->msgid = g_strdup (ref->msgid);
+ node->next = NULL;
+
+ ref = ref->next;
+ }
+
+ return copy;
+}
+
+
+/**
* g_mime_references_append:
* @refs: the address of a #GMimeReferences list
* @msgid: a message-id string
diff --git a/gmime/gmime-utils.h b/gmime/gmime-utils.h
index f6b808f..4f0a8d3 100644
--- a/gmime/gmime-utils.h
+++ b/gmime/gmime-utils.h
@@ -57,6 +57,7 @@ char *g_mime_utils_decode_message_id (const char *message_id);
/* decode a References or In-Reply-To header */
GMimeReferences *g_mime_references_decode (const char *text);
+GMimeReferences *g_mime_references_copy (GMimeReferences *references);
void g_mime_references_append (GMimeReferences **refs, const char *msgid);
void g_mime_references_clear (GMimeReferences **refs);
void g_mime_references_free (GMimeReferences *refs);
diff --git a/gmime/gmime.c b/gmime/gmime.c
index 18a29b3..63ba849 100644
--- a/gmime/gmime.c
+++ b/gmime/gmime.c
@@ -128,6 +128,10 @@ g_mime_init (void)
gmime_gpgme_error_quark = g_quark_from_static_string ("gmime-gpgme");
gmime_error_quark = g_quark_from_static_string ("gmime");
+ g_boxed_type_register_static ("GMimeReferences",
+ (GBoxedCopyFunc) g_mime_references_copy,
+ (GBoxedFreeFunc) g_mime_references_free);
+
/* register our GObject types with the GType system */
g_mime_crypto_context_get_type ();
g_mime_decrypt_result_get_type ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]