From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id E41C3431FAF for ; Sat, 24 Nov 2012 15:27:33 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id piMpu8N-EZ5A for ; Sat, 24 Nov 2012 15:27:30 -0800 (PST) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id 0ED93431FAE for ; Sat, 24 Nov 2012 15:27:30 -0800 (PST) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 5351610010B; Sun, 25 Nov 2012 01:27:28 +0200 (EET) From: Tomi Ollila To: david@tethera.net, notmuch@notmuchmail.org Subject: Re: [Patch v2 09/17] tag-util.[ch]: New files for common tagging routines In-Reply-To: <1353792017-31459-10-git-send-email-david@tethera.net> References: <1353792017-31459-1-git-send-email-david@tethera.net> <1353792017-31459-10-git-send-email-david@tethera.net> User-Agent: Notmuch/0.14+84~g8a199bf (http://notmuchmail.org) Emacs/24.2.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain Cc: David Bremner X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Nov 2012 23:27:34 -0000 On Sat, Nov 24 2012, david@tethera.net wrote: > From: David Bremner > > 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). > --- dumping all except beginning of tag-util.h... > tag-util.h | 120 ++++++++++++++++++++++++++ > diff --git a/tag-util.h b/tag-util.h > new file mode 100644 > index 0000000..508806f > --- /dev/null > +++ b/tag-util.h > @@ -0,0 +1,120 @@ > +#ifndef _TAG_UTIL_H > +#define _TAG_UTIL_H > + > +#include "notmuch-client.h" > + > +typedef struct _tag_operation_t tag_operation_t; > +typedef struct _tag_op_list_t tag_op_list_t; > + > +#define TAG_OP_LIST_INITIAL_SIZE 10 > + > +/* Use powers of 2 */ > +typedef enum { TAG_FLAG_NONE = 0, > + /* Operations are synced to maildir, if possible */ > + > + TAG_FLAG_MAILDIR_SYNC = 1, > + > + /* Remove all tags from message before applying > + * list */ > + > + TAG_FLAG_REMOVE_ALL = 2, > + > + /* Don't try to avoid database operations. Useful > + * when we know that message passed needs these > + * operations. */ > + > + TAG_FLAG_PRE_OPTIMIZED = 4, > + > + /* Accept strange tags that might be user error; > + intended for use by notmuch-restore. > + */ > + > + TAG_FLAG_BE_GENEROUS = 8} tag_op_flag_t; > + Maybe something like the following formatted and consistency-tuned version: typedef enum { TAG_FLAG_NONE = 0, /* Operations are synced to maildir, if possible. */ TAG_FLAG_MAILDIR_SYNC = (1 << 0), /* Remove all tags from message before applying list. */ TAG_FLAG_REMOVE_ALL = (1 << 1), /* Don't try to avoid database operations. Useful when we * know that message passed needs these operations. */ TAG_FLAG_PRE_OPTIMIZED = (1 << 2), /* Accept strange tags that might be user error; * intended for use by notmuch-restore. */ TAG_FLAG_BE_GENEROUS = (1 << 3) } tag_op_flag_t; Tomi