diff options
author | Jeffrey Stedfast <jestedfa@microsoft.com> | 2019-11-09 08:26:28 -0500 |
---|---|---|
committer | Jeffrey Stedfast <jestedfa@microsoft.com> | 2019-11-10 08:23:22 -0500 |
commit | b14d4e6901272c388e2215c43f347a00667efa58 (patch) | |
tree | 441ed5ba2514061f167c4df2cfe036f23c46e8cc | |
parent | 6d7c904e52bdfd723db990a326527fd65e45320a (diff) | |
download | gmime-b14d4e6901272c388e2215c43f347a00667efa58.tar.gz |
minor stylistic fixes
-rw-r--r-- | gmime/gmime-multipart.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/gmime/gmime-multipart.c b/gmime/gmime-multipart.c index f27dbb51..da209705 100644 --- a/gmime/gmime-multipart.c +++ b/gmime/gmime-multipart.c @@ -795,38 +795,41 @@ g_mime_multipart_foreach (GMimeMultipart *multipart, GMimeObjectForeachFunc call GMimeForeachData *tmp; GQueue *queue; guint i; + g_return_if_fail (GMIME_IS_MULTIPART (multipart)); g_return_if_fail (callback != NULL); tmp = g_malloc (sizeof (GMimeForeachData)); queue = g_queue_new (); - + tmp->parent = (GMimeObject *) multipart; tmp->part = (GMimeObject *) multipart; - + g_queue_push_tail (queue, tmp); - + while ((tmp = (GMimeForeachData *) g_queue_pop_head (queue))) { GMimeObject *parent = tmp->parent; GMimeObject *part = tmp->part; - + g_free (tmp); + if (part != parent) callback (parent, part, user_data); - + if (GMIME_IS_MULTIPART (part)) { multipart = (GMimeMultipart *) part; i = multipart->children->len; + while (i > 0) { tmp = g_malloc (sizeof (GMimeForeachData)); - tmp->parent = part; tmp->part = (GMimeObject *) multipart->children->pdata[--i]; - + tmp->parent = part; + g_queue_push_head (queue, tmp); } } } - + g_queue_free (queue); } |