From: David Bremner Date: Wed, 10 Feb 2016 02:37:04 +0000 (+2000) Subject: Re: [PATCH v3 03/16] make shared crypto code behave library-like X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=139f4b04ff6a9a4353629b9bca011c61d5f6a57d;p=notmuch-archives.git Re: [PATCH v3 03/16] make shared crypto code behave library-like --- diff --git a/13/1bd5420f8089df58f5cfc8fcfd2c4286831774 b/13/1bd5420f8089df58f5cfc8fcfd2c4286831774 new file mode 100644 index 000000000..d4487c82c --- /dev/null +++ b/13/1bd5420f8089df58f5cfc8fcfd2c4286831774 @@ -0,0 +1,98 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 3C9E36DE0231 + for ; Tue, 9 Feb 2016 18:37:09 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.308 +X-Spam-Level: +X-Spam-Status: No, score=-0.308 tagged_above=-999 required=5 tests=[AWL=0.243, + RP_MATCHES_RCVD=-0.55, SPF_PASS=-0.001] 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 WUl1xY7pFNwf for ; + Tue, 9 Feb 2016 18:37:07 -0800 (PST) +Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) + by arlo.cworth.org (Postfix) with ESMTPS id 622E56DE021E + for ; Tue, 9 Feb 2016 18:37:07 -0800 (PST) +Received: from remotemail by fethera.tethera.net with local (Exim 4.84) + (envelope-from ) + id 1aTKdl-0001dj-H1; Tue, 09 Feb 2016 21:36:25 -0500 +Received: (nullmailer pid 14530 invoked by uid 1000); + Wed, 10 Feb 2016 02:37:04 -0000 +From: David Bremner +To: Daniel Kahn Gillmor , + Notmuch Mail +Subject: Re: [PATCH v3 03/16] make shared crypto code behave library-like +In-Reply-To: <1454272801-23623-4-git-send-email-dkg@fifthhorseman.net> +References: <1454272801-23623-1-git-send-email-dkg@fifthhorseman.net> + <1454272801-23623-4-git-send-email-dkg@fifthhorseman.net> +User-Agent: Notmuch/0.21+5~gca076ce (http://notmuchmail.org) Emacs/24.5.1 + (x86_64-pc-linux-gnu) +Date: Tue, 09 Feb 2016 22:37:04 -0400 +Message-ID: <87twlhuw8f.fsf@maritornes.cs.unb.ca> +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 02:37:09 -0000 + +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. +> /* 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? +> +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. + +d + +