[PATCH v4 1/7] cli: use typedef to deal with gmime 2.4/2.6 incompatibility
authorJameson Graef Rollins <jrollins@finestructure.net>
Wed, 23 May 2012 22:40:37 +0000 (15:40 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:47:17 +0000 (09:47 -0800)
da/193d8d544165928b0ba19b5747fbac6158bcee [new file with mode: 0644]

diff --git a/da/193d8d544165928b0ba19b5747fbac6158bcee b/da/193d8d544165928b0ba19b5747fbac6158bcee
new file mode 100644 (file)
index 0000000..7d3ac54
--- /dev/null
@@ -0,0 +1,129 @@
+Return-Path: <jrollins@finestructure.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 25F74431FAF\r
+       for <notmuch@notmuchmail.org>; Wed, 23 May 2012 15:40:51 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id R8Na3iaDkc-G for <notmuch@notmuchmail.org>;\r
+       Wed, 23 May 2012 15:40:50 -0700 (PDT)\r
+Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
+       [131.215.239.19])\r
+       by olra.theworths.org (Postfix) with ESMTP id 6A6E4431FBC\r
+       for <notmuch@notmuchmail.org>; Wed, 23 May 2012 15:40:50 -0700 (PDT)\r
+Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
+       by fire-doxen-postvirus (Postfix) with ESMTP id 1332A328043\r
+       for <notmuch@notmuchmail.org>; Wed, 23 May 2012 15:40:48 -0700 (PDT)\r
+X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
+Received: from finestructure.net (unknown [137.151.175.56])\r
+       (Authenticated sender: jrollins)\r
+       by fire-doxen-submit (Postfix) with ESMTP id 45C4E32807F\r
+       for <notmuch@notmuchmail.org>; Wed, 23 May 2012 15:40:46 -0700 (PDT)\r
+Received: by finestructure.net (Postfix, from userid 1000)\r
+       id F0629E3; Wed, 23 May 2012 15:40:45 -0700 (PDT)\r
+From: Jameson Graef Rollins <jrollins@finestructure.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH v4 1/7] cli: use typedef to deal with gmime 2.4/2.6\r
+       incompatibility\r
+Date: Wed, 23 May 2012 15:40:37 -0700\r
+Message-Id: <1337812843-14986-2-git-send-email-jrollins@finestructure.net>\r
+X-Mailer: git-send-email 1.7.10\r
+In-Reply-To: <1337812843-14986-1-git-send-email-jrollins@finestructure.net>\r
+References: <1337812843-14986-1-git-send-email-jrollins@finestructure.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 23 May 2012 22:40:51 -0000\r
+\r
+gmime 2.4 defines GMimeCipherContext, while 2.6 defines\r
+GMimeCryptoContext.  We can use a typedef to cover this discrepancy\r
+and remove a bunch of #ifdefs.\r
+---\r
+ mime-node.c      |    8 --------\r
+ notmuch-client.h |   10 ++--------\r
+ 2 files changed, 2 insertions(+), 16 deletions(-)\r
+\r
+diff --git a/mime-node.c b/mime-node.c\r
+index a95bdab..06fdb70 100644\r
+--- a/mime-node.c\r
++++ b/mime-node.c\r
+@@ -33,11 +33,7 @@ typedef struct mime_node_context {\r
+     GMimeMessage *mime_message;\r
\r
+     /* Context provided by the caller. */\r
+-#ifdef GMIME_ATLEAST_26\r
+     GMimeCryptoContext *cryptoctx;\r
+-#else\r
+-    GMimeCipherContext *cryptoctx;\r
+-#endif\r
+     notmuch_bool_t decrypt;\r
+ } mime_node_context_t;\r
\r
+@@ -61,11 +57,7 @@ _mime_node_context_free (mime_node_context_t *res)\r
\r
+ notmuch_status_t\r
+ mime_node_open (const void *ctx, notmuch_message_t *message,\r
+-#ifdef GMIME_ATLEAST_26\r
+               GMimeCryptoContext *cryptoctx,\r
+-#else\r
+-              GMimeCipherContext *cryptoctx,\r
+-#endif\r
+               notmuch_bool_t decrypt, mime_node_t **root_out)\r
+ {\r
+     const char *filename = notmuch_message_get_filename (message);\r
+diff --git a/notmuch-client.h b/notmuch-client.h\r
+index 19b7f01..337409f 100644\r
+--- a/notmuch-client.h\r
++++ b/notmuch-client.h\r
+@@ -36,6 +36,8 @@\r
+  * these to check the version number. */\r
+ #ifdef GMIME_MAJOR_VERSION\r
+ #define GMIME_ATLEAST_26\r
++#else\r
++typedef GMimeCipherContext GMimeCryptoContext;\r
+ #endif\r
\r
+ #include "notmuch.h"\r
+@@ -79,11 +81,7 @@ typedef struct notmuch_show_params {\r
+     notmuch_bool_t omit_excluded;\r
+     notmuch_bool_t raw;\r
+     int part;\r
+-#ifdef GMIME_ATLEAST_26\r
+     GMimeCryptoContext* cryptoctx;\r
+-#else\r
+-    GMimeCipherContext* cryptoctx;\r
+-#endif\r
+     notmuch_bool_t decrypt;\r
+ } notmuch_show_params_t;\r
\r
+@@ -355,11 +353,7 @@ struct mime_node {\r
+  */\r
+ notmuch_status_t\r
+ mime_node_open (const void *ctx, notmuch_message_t *message,\r
+-#ifdef GMIME_ATLEAST_26\r
+               GMimeCryptoContext *cryptoctx,\r
+-#else\r
+-              GMimeCipherContext *cryptoctx,\r
+-#endif\r
+               notmuch_bool_t decrypt, mime_node_t **node_out);\r
\r
+ /* Return a new MIME node for the requested child part of parent.\r
+-- \r
+1.7.10\r
+\r