On Wed, 9 Nov 2011 08:44:35 -0500, Austin Clements <amdragon@MIT.EDU> wrote: > This optimizes the user's tagging query to exclude messages that won't > be affected by the tagging operation, saving computation and IO for > redundant tagging operations. > > For example, > notmuch tag +notmuch to:notmuch@notmuchmail.org > will now use the query > ( to:notmuch@notmuchmail.org ) and (not tag:"notmuch") > > In the past, we've often suggested that people do this exact > transformation by hand for slow tagging operations. This makes that > unnecessary. > --- > This version addresses Jani's comments. > > NEWS | 9 ++++++ > notmuch-tag.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 94 insertions(+), 0 deletions(-) > Reviewed code, looks good * Empty query string checked before entering _optimize_tag_query (if that matters) * All allocations checked * The logic look sound and creation of that query string is ok, too. * I trust escaping is done the way it is done (quotes around, doubling any quotes (") in string). * orig_query_string could be freed in _optimize_query_string() the data becomes garbage pointer to it lost after that call. However, _optimize_query_string() doesn't know that so it is better to leave talloc do the freeing (a bit later). Tomi