Re: [PATCH v2 04/16] Provide _notmuch_crypto_{set,get}_gpg_path

Subject: Re: [PATCH v2 04/16] Provide _notmuch_crypto_{set,get}_gpg_path

Date: Sun, 24 Jan 2016 17:23:02 +0200

To: Daniel Kahn Gillmor, Notmuch Mail

Cc:

From: Tomi Ollila


On Wed, Jan 20 2016, Daniel Kahn Gillmor <dkg@fifthhorseman.net> wrote:

> Use functions to access the gpg_path for a _notmuch_crypto_t object.
> This lets us return sensible defaults based on the state of the user's
> machine.
> ---
>  notmuch-reply.c | 13 ++++++++++---
>  notmuch-show.c  | 12 ++++++++++--
>  util/crypto.c   | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
>  util/crypto.h   |  8 +++++++-
>  4 files changed, 75 insertions(+), 7 deletions(-)
>
> diff --git a/util/crypto.c b/util/crypto.c
> index c18c82c..0b51347 100644
> --- a/util/crypto.c
> +++ b/util/crypto.c
> @@ -21,7 +21,11 @@
>  
>  #include "notmuch.h"
>  #include "crypto.h"
> +#include "search-path.h"
>  #include <string.h>
> +#include <talloc.h>
> +
> +#define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0]))
>  
>  #define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0]))

duplicate ARRAY_SIZE definition ?

>  
> @@ -38,7 +42,7 @@ get_gpg_context (_notmuch_crypto_t *crypto, GMimeCryptoContext **ctx)
>      }
>  
>      /* TODO: GMimePasswordRequestFunc */
> -    crypto->gpgctx = g_mime_gpg_context_new (NULL, crypto->gpgpath ? crypto->gpgpath : "gpg");
> +    crypto->gpgctx = g_mime_gpg_context_new (NULL, _notmuch_crypto_get_gpg_path(crypto));
>      if (! crypto->gpgctx) {

Thread: