From: David Bremner <david@tethera.net>
To: notmuch@notmuchmail.org, notmuch@freelists.org
Subject: [PATCH 1/5] util: convenience function to create gmime stream for stdout
Date: Sun, 21 May 2017 09:48:17 -0300 [thread overview]
Message-ID: <20170521124821.23924-2-david@tethera.net> (raw)
In-Reply-To: <20170521124821.23924-1-david@tethera.net>
It turns out that our use of GMimeStreamPipe has only succeeded
because gmime has been ignoring some seek failures; this will no
longer be the case in gmime 3.0, so we use a GMimeStreamPipe, which
does not assume seekability, wrapped in a buffering stream.
---
util/Makefile.local | 2 +-
| 15 +++++++++++++++
| 6 ++++++
3 files changed, 22 insertions(+), 1 deletion(-)
create mode 100644 util/gmime-extra.c
create mode 100644 util/gmime-extra.h
diff --git a/util/Makefile.local b/util/Makefile.local
index a6962d49..3027880b 100644
--- a/util/Makefile.local
+++ b/util/Makefile.local
@@ -5,7 +5,7 @@ extra_cflags += -I$(srcdir)/$(dir)
libnotmuch_util_c_srcs := $(dir)/xutil.c $(dir)/error_util.c $(dir)/hex-escape.c \
$(dir)/string-util.c $(dir)/talloc-extra.c $(dir)/zlib-extra.c \
- $(dir)/util.c
+ $(dir)/util.c $(dir)/gmime-extra.c
libnotmuch_util_modules := $(libnotmuch_util_c_srcs:.c=.o)
--git a/util/gmime-extra.c b/util/gmime-extra.c
new file mode 100644
index 00000000..d0366812
--- /dev/null
+++ b/util/gmime-extra.c
@@ -0,0 +1,15 @@
+#include "gmime-extra.h"
+
+GMimeStream *
+g_mime_stream_stdout_new()
+{
+ GMimeStream *stream_stdout = NULL;
+
+ stream_stdout = g_mime_stream_pipe_new (STDOUT_FILENO);
+ if (!stream_stdout)
+ return NULL;
+
+ g_mime_stream_pipe_set_owner (GMIME_STREAM_PIPE (stream_stdout), FALSE);
+
+ return g_mime_stream_buffer_new (stream_stdout, GMIME_STREAM_BUFFER_BLOCK_WRITE);
+}
--git a/util/gmime-extra.h b/util/gmime-extra.h
new file mode 100644
index 00000000..e0432a94
--- /dev/null
+++ b/util/gmime-extra.h
@@ -0,0 +1,6 @@
+#ifndef _GMIME_EXTRA_H
+#define _GMIME_EXTRA_H
+#include <gmime/gmime.h>
+
+GMimeStream *g_mime_stream_stdout_new(void);
+#endif
--
2.11.0
next prev parent reply other threads:[~2017-05-21 12:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-21 12:48 gmime 3.0 related preliminaries David Bremner
2017-05-21 12:48 ` David Bremner [this message]
2017-05-21 13:28 ` [PATCH 1/5] util: convenience function to create gmime stream for stdout David Bremner
2017-05-21 15:34 ` David Bremner
2017-05-21 12:48 ` [PATCH 2/5] cli/reply: direct all output for text format to gmime stream David Bremner
2017-05-21 12:48 ` [PATCH 3/5] cli/show: use single stream for printf / gmime object output David Bremner
2017-05-21 12:48 ` [PATCH 4/5] perf-test: add memory test for reply David Bremner
2017-05-21 12:48 ` [PATCH 5/5] cli/reply: fix memory leak David Bremner
2017-05-21 13:17 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170521124821.23924-2-david@tethera.net \
--to=david@tethera.net \
--cc=notmuch@freelists.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).