Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 7EBD3431FBC for ; Fri, 25 May 2012 07:41:40 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mtv+RlQ-QbtJ for ; Fri, 25 May 2012 07:41:39 -0700 (PDT) Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU [18.7.68.35]) by olra.theworths.org (Postfix) with ESMTP id CB26D431FB6 for ; Fri, 25 May 2012 07:41:39 -0700 (PDT) X-AuditID: 12074423-b7fcc6d0000008a8-11-4fbf9a237399 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP id FE.63.02216.32A9FBF4; Fri, 25 May 2012 10:41:39 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q4PEfcCK008281; Fri, 25 May 2012 10:41:38 -0400 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q4PEfaOF007396 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Fri, 25 May 2012 10:41:37 -0400 (EDT) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1SXvhw-0000dT-Ly; Fri, 25 May 2012 10:41:36 -0400 Date: Fri, 25 May 2012 10:41:36 -0400 From: Austin Clements To: Jameson Graef Rollins Subject: Re: [PATCH v4 1/7] cli: use typedef to deal with gmime 2.4/2.6 incompatibility Message-ID: <20120525144136.GB11804@mit.edu> References: <1337812843-14986-1-git-send-email-jrollins@finestructure.net> <1337812843-14986-2-git-send-email-jrollins@finestructure.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1337812843-14986-2-git-send-email-jrollins@finestructure.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPIsWRmVeSWpSXmKPExsUixCmqras8a7+/waeNPBZ79nlZXL85k9mB yePuaS6PZ6tuMQcwRXHZpKTmZJalFunbJXBl7Dj3i7VgrVjF20W5DYwvBLsYOTkkBEwkWua9 YISwxSQu3FvP1sXIxSEksI9RoqlzFSuEs4FRYuvPHSwgVUICJ5kkGmeLQSSWMEr87NnFBpJg EVCVOPHrHhOIzSagIbFt/3KwsSICZhI9X/6A2cwCWhJbN34Asjk4hAUiJRZ+1AQJ8wroSJz4 0wA1v5tRoueBAERcUOLkzCcsMK03/r1kAmllFpCWWP6PAyTMKeAtsfLADbALRAVUJKac3MY2 gVFoFpLuWUi6ZyF0L2BkXsUom5JbpZubmJlTnJqsW5ycmJeXWqRrppebWaKXmlK6iREUzuwu yjsY/xxUOsQowMGoxMPLGL3PX4g1say4MvcQoyQHk5Iob8jM/f5CfEn5KZUZicUZ8UWlOanF hxglOJiVRHhZ0oByvCmJlVWpRfkwKWkOFiVx3rWau/2FBNITS1KzU1MLUotgsjIcHEoSvGEg QwWLUtNTK9Iyc0oQ0kwcnCDDeYCGR4HU8BYXJOYWZ6ZD5E8xKkqJ84aCJARAEhmleXC9sHTz ilEc6BVhiHYeYKqC634FNJgJaPCWx3tBBpckIqSkGhidE+KO8F9a+tTHhd0jmtVrIdP7Rc2d 85ryvAxXSqtt2KuyecsVJyON2p9V2Wu3ubCVLxUXUVubwKNz/GTs3MuGK8vbn685zv2wYN2N fa2TspTPaXt0q6vO7WOO9tqkdujkG4NL2w577JTbefT8qzv6hiWWLu+iQib/2R1VtHzLUYE7 FZwVMrFKLMUZiYZazEXFiQBh2tHKEgMAAA== Cc: Notmuch Mail X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 May 2012 14:41:40 -0000 Quoth Jameson Graef Rollins on May 23 at 3:40 pm: > gmime 2.4 defines GMimeCipherContext, while 2.6 defines > GMimeCryptoContext. We can use a typedef to cover this discrepancy > and remove a bunch of #ifdefs. > --- > mime-node.c | 8 -------- > notmuch-client.h | 10 ++-------- > 2 files changed, 2 insertions(+), 16 deletions(-) > > diff --git a/mime-node.c b/mime-node.c > index a95bdab..06fdb70 100644 > --- a/mime-node.c > +++ b/mime-node.c > @@ -33,11 +33,7 @@ typedef struct mime_node_context { > GMimeMessage *mime_message; > > /* Context provided by the caller. */ > -#ifdef GMIME_ATLEAST_26 > GMimeCryptoContext *cryptoctx; > -#else > - GMimeCipherContext *cryptoctx; > -#endif > notmuch_bool_t decrypt; > } mime_node_context_t; > > @@ -61,11 +57,7 @@ _mime_node_context_free (mime_node_context_t *res) > > notmuch_status_t > mime_node_open (const void *ctx, notmuch_message_t *message, > -#ifdef GMIME_ATLEAST_26 > GMimeCryptoContext *cryptoctx, > -#else > - GMimeCipherContext *cryptoctx, > -#endif > notmuch_bool_t decrypt, mime_node_t **root_out) > { > const char *filename = notmuch_message_get_filename (message); > diff --git a/notmuch-client.h b/notmuch-client.h > index 19b7f01..337409f 100644 > --- a/notmuch-client.h > +++ b/notmuch-client.h > @@ -36,6 +36,8 @@ > * these to check the version number. */ > #ifdef GMIME_MAJOR_VERSION > #define GMIME_ATLEAST_26 > +#else > +typedef GMimeCipherContext GMimeCryptoContext; I like the typedef idea, but I don't think we should overload GMimeCryptoContext like this. If someone is reading through the GMime 2.4 code and sees this, they're going to assume that it's a GMime structure, go looking for it, find that it's only in 2.6 and be baffled. Instead, how about providing a typedef to abstract *both* cases? Something like #ifdef GMIME_MAJOR_VERSION #define GMIME_ATLEAST_26 typedef notmuch_crypto_context_t GMimeCipherContext; #else typedef notmuch_crypto_context_t GMimeCryptoContext; #endif > #endif > > #include "notmuch.h" > @@ -79,11 +81,7 @@ typedef struct notmuch_show_params { > notmuch_bool_t omit_excluded; > notmuch_bool_t raw; > int part; > -#ifdef GMIME_ATLEAST_26 > GMimeCryptoContext* cryptoctx; > -#else > - GMimeCipherContext* cryptoctx; > -#endif > notmuch_bool_t decrypt; > } notmuch_show_params_t; > > @@ -355,11 +353,7 @@ struct mime_node { > */ > notmuch_status_t > mime_node_open (const void *ctx, notmuch_message_t *message, > -#ifdef GMIME_ATLEAST_26 > GMimeCryptoContext *cryptoctx, > -#else > - GMimeCipherContext *cryptoctx, > -#endif > notmuch_bool_t decrypt, mime_node_t **node_out); > > /* Return a new MIME node for the requested child part of parent.