Commit graph

4 commits

Author SHA1 Message Date
Peter Wang
f00c925bd1 tag-util: do not reset list in parse_tag_command_line
The 'insert' command will be better served if parse_tag_command_line
modifies a pre-populated list (of new.tags) instead of clobbering the
list outright.  The sole existing caller, notmuch_tag_command, is
unaffected by this change.
2013-06-29 14:36:23 -03:00
David Bremner
e9b6e46474 notmuch-tag.c: convert to use tag-util
Command line parsing is factored out into a function
parse_tag_command_line in tag-util.c.

There is some duplicated code eliminated in tag_query, and a bunch of
translation from using the bare tag_op structs to using that tag-utils
API.
2013-01-07 20:42:21 -04:00
David Bremner
ba4e856529 tag-utils: use the tag_opt_list_t as talloc context, if possible.
The memory usage discipline of tag_op_list_t is never to free the
internal array of tag operations before freeing the whole list, so it
makes sense to take advantage of hierarchical de-allocation by talloc.

By not relying on the context passed into tag_parse_line, we can allow
tag_op_list_t structures to live longer than that context.
2012-12-22 23:13:15 -04:00
David Bremner
fb50cc41fe tag-util.[ch]: New files for common tagging routines
These are meant to be shared between notmuch-tag and notmuch-restore.

The bulk of the routines implement a "tag operation list" abstract
data type act as a structured representation of a set of tag
operations (typically coming from a single tag command or line of
input).
2012-12-09 13:33:34 -04:00