From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 659C66DE0B36 for ; Wed, 10 Feb 2016 08:18:42 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.018 X-Spam-Level: X-Spam-Status: No, score=-0.018 tagged_above=-999 required=5 tests=[AWL=-0.018] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1TNRkEoPGqyy for ; Wed, 10 Feb 2016 08:18:40 -0800 (PST) Received: from che.mayfirst.org (che.mayfirst.org [209.234.253.108]) by arlo.cworth.org (Postfix) with ESMTP id 6608F6DE01D3 for ; Wed, 10 Feb 2016 08:18:40 -0800 (PST) Received: from fifthhorseman.net (unknown [38.109.115.130]) by che.mayfirst.org (Postfix) with ESMTPSA id 76C3EF997; Wed, 10 Feb 2016 11:18:20 -0500 (EST) Received: by fifthhorseman.net (Postfix, from userid 1000) id 270FE1FF75; Wed, 10 Feb 2016 11:18:19 -0500 (EST) From: Daniel Kahn Gillmor To: David Bremner , Notmuch Mail Subject: Re: [PATCH v3 03/16] make shared crypto code behave library-like In-Reply-To: <87twlhuw8f.fsf@maritornes.cs.unb.ca> References: <1454272801-23623-1-git-send-email-dkg@fifthhorseman.net> <1454272801-23623-4-git-send-email-dkg@fifthhorseman.net> <87twlhuw8f.fsf@maritornes.cs.unb.ca> User-Agent: Notmuch/0.21+72~gd8c4f1c (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Wed, 10 Feb 2016 11:18:18 -0500 Message-ID: <87d1s4o7xx.fsf@alice.fifthhorseman.net> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.20 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: Wed, 10 Feb 2016 16:18:42 -0000 On Tue 2016-02-09 21:37:04 -0500, David Bremner wrote: > Daniel Kahn Gillmor writes: >> -static GMimeCryptoContext* >> -create_gpg_context (_notmuch_crypto_t *crypto) >> +static notmuch_status_t >> +get_gpg_context (_notmuch_crypto_t *crypto, GMimeCryptoContext **ctx) > > I was a littled puzzled by this renaming. I guess it's fine, it just > creates a bit more diff noise. the renaming from create_ to get_ is meaningful -- this function won't actually create a new gpg context if one already exists. >> /* Create a PKCS7 context (GMime 2.6) */ >> -static notmuch_crypto_context_t * >> -create_pkcs7_context (notmuch_crypto_t *crypto) >> +static notmuch_status_t >> +create_pkcs7_context (_notmuch_crypto_t *crypto, GMimeCryptoContext **ctx) > > Especially since you only renamed the gpg version. Or did I miss > something? ah, you're right here, this should be fixed. >> +notmuch_status_t >> +_notmuch_crypto_get_gmime_ctx_for_protocol (_notmuch_crypto_t *crypto, >> + const char *protocol, >> + GMimeCryptoContext **ctx) >> { >> - GMimeCryptoContext *cryptoctx = NULL; >> - size_t i; >> - >> - if (! protocol) { >> - fprintf (stderr, "Cryptographic protocol is empty.\n"); >> - return cryptoctx; >> - } >> + if (! protocol) >> + return NOTMUCH_STATUS_MALFORMED_CRYPTO_PROTOCOL; >> >> /* As per RFC 1847 section 2.1: "the [protocol] value token is >> * comprised of the type and sub-type tokens of the Content-Type". >> @@ -112,15 +112,12 @@ _notmuch_crypto_get_gmime_context (_notmuch_crypto_t *crypto, const char *protoc >> * parameter names as defined in this document are >> * case-insensitive." Thus, we use strcasecmp for the protocol. >> */ >> - for (i = 0; i < ARRAY_SIZE (protocols); i++) { >> + for (size_t i = 0; i < ARRAY_SIZE (protocols); i++) { > > I forget whether we are using C99 for loop variable declarations. I > like them myself. If someone figures out the answer, maybe they can > update devel/STYLE. is what i did above a C99 loop variable declaration? If so, i also like them. I've left it in for now :) --dkg