From: Austin Clements <amdragon@MIT.EDU>
To: Tomi Ollila <tomi.ollila@iki.fi>
Cc: notmuch@notmuchmail.org
Subject: Re: [Patch 1/2] separate handling when addresses == NULL
Date: Fri, 9 Dec 2011 10:57:21 -0500 [thread overview]
Message-ID: <20111209155704.GE3190@mit.edu> (raw)
In-Reply-To: <yf6ehwdx36v.fsf@taco2.nixu.fi>
Quoth Tomi Ollila on Dec 09 at 3:52 pm:
> When addresses is NULL, (future) addresses object cleanup is not needed.
> ---
> notmuch-show.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/notmuch-show.c b/notmuch-show.c
> index 603992a..c27ef6a 100644
> --- a/notmuch-show.c
> +++ b/notmuch-show.c
> @@ -239,7 +239,11 @@ _extract_email_address (const void *ctx, const char *from)
> addresses = internet_address_list_parse_string (from);
>
> /* Bail if there is no address here. */
> - if (addresses == NULL || internet_address_list_length (addresses) < 1)
> + if (addresses == NULL)
> + return email;
> +
> + /* Bail if there is no address here. */
> + if (internet_address_list_length (addresses) < 1)
> goto DONE;
Personally, I would much prefer to see the code as it was---with the
sometimes unnecessary goto DONE---and an if (addresses) around the
later cleanup that the second patch adds. It's more maintainable in
case someone ever adds more code earlier in this function and this
microoptimization isn't buying you anything.
>
> /* Otherwise, just use the first address. */
next prev parent reply other threads:[~2011-12-09 15:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-07 20:13 [PATCH] Release memory allocated by internet_address_list_parse_string() Tomi Ollila
2011-12-07 21:29 ` Tomi Ollila
2011-12-09 13:52 ` [Patch 1/2] separate handling when addresses == NULL Tomi Ollila
2011-12-09 15:57 ` Austin Clements [this message]
2011-12-09 13:53 ` [PATCH 2/2] Release memory allocated by internet_address_list_parse_string() Tomi Ollila
2011-12-10 10:18 ` [PATCH v3] " Tomi Ollila
2011-12-11 14:49 ` David Bremner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20111209155704.GE3190@mit.edu \
--to=amdragon@mit.edu \
--cc=notmuch@notmuchmail.org \
--cc=tomi.ollila@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).