[PATCH 4/6] cli: intialize crypto structure in show and reply

Jani Nikula jani at nikula.org
Thu May 17 00:47:07 PDT 2012


On Thu, 17 May 2012, Jameson Graef Rollins <jrollins at finestructure.net> wrote:
> This makes sure it has proper initialization values when it's created.

Please don't do this. It's unnecessary; if one field is initialized with
a designated initializer, the rest are initialized to zero (or NULL).

BR,
Jani.


> ---
>  notmuch-reply.c |    5 ++++-
>  notmuch-show.c  |   10 +++++++++-
>  2 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/notmuch-reply.c b/notmuch-reply.c
> index 6662adb..3c967a0 100644
> --- a/notmuch-reply.c
> +++ b/notmuch-reply.c
> @@ -673,7 +673,10 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
>      char *query_string;
>      int opt_index, ret = 0;
>      int (*reply_format_func)(void *ctx, notmuch_config_t *config, notmuch_query_t *query, notmuch_crypto_t *crypto, notmuch_bool_t reply_all);
> -    notmuch_crypto_t crypto = { .decrypt = FALSE };
> +    notmuch_crypto_t crypto = {
> +	.decrypt = FALSE,
> +	.gpgctx = NULL,
> +    };
>      int format = FORMAT_DEFAULT;
>      int reply_all = TRUE;
>  
> diff --git a/notmuch-show.c b/notmuch-show.c
> index 8b4d308..c606333 100644
> --- a/notmuch-show.c
> +++ b/notmuch-show.c
> @@ -983,7 +983,15 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
>      char *query_string;
>      int opt_index, ret;
>      const notmuch_show_format_t *format = &format_text;
> -    notmuch_show_params_t params = { .part = -1, .omit_excluded = TRUE };
> +    notmuch_crypto_t crypto = {
> +	.decrypt = FALSE,
> +	.gpgctx = NULL,
> +    };
> +    notmuch_show_params_t params = {
> +	.part = -1,
> +	.omit_excluded = TRUE,
> +	.crypto = crypto,
> +    };
>      int format_sel = NOTMUCH_FORMAT_NOT_SPECIFIED;
>      notmuch_bool_t verify = FALSE;
>      int exclude = EXCLUDE_TRUE;
> -- 
> 1.7.10
>
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list