Re: [PATCH v2 04/14] cli/reply: unify reply format functions

Subject: Re: [PATCH v2 04/14] cli/reply: unify reply format functions

Date: Sat, 10 Sep 2016 09:26:43 +0300

To: David Bremner, notmuch@notmuchmail.org

Cc:

From: Jani Nikula


On Sat, 10 Sep 2016, David Bremner <david@tethera.net> wrote:
> Jani Nikula <jani@nikula.org> writes:
>
>> Prepare for further future unification by making the code similar. The
>> only functional change is that errors in mime_node_open() also break
>> execution in default reply format.
>
>>      GMimeMessage *reply;
>> -    mime_node_t *root;
>> +    mime_node_t *node;
>> +
>> +    if (mime_node_open (ctx, message, &params->crypto, &node))
>> +	return 1;
>>  
>>      reply = create_reply_message (ctx, config, message, reply_all);
>>      if (!reply)
>>  	return 1;
>>  
>>      show_reply_headers (reply);
>> +    format_part_reply (node);
>>  
>>      g_object_unref (G_OBJECT (reply));
>
> I'm not sure if this matters in the long run, but a related change is
> that the g_object_unref is skipped in case mime_node_open returns an
> error.

The order changes too, we don't yet have an object to g_object_unref if
mime_node_open fails.

BR,
Jani.

Thread: