Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id D3269431FD0 for ; Wed, 22 Dec 2010 18:45:00 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.698 X-Spam-Level: X-Spam-Status: No, score=-0.698 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 r8sgxa3UpzBG for ; Wed, 22 Dec 2010 18:45:00 -0800 (PST) Received: from mail-qw0-f53.google.com (mail-qw0-f53.google.com [209.85.216.53]) by olra.theworths.org (Postfix) with ESMTP id 056A5431FB6 for ; Wed, 22 Dec 2010 18:44:59 -0800 (PST) Received: by qwe5 with SMTP id 5so6270175qwe.26 for ; Wed, 22 Dec 2010 18:44:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=r17eUEsp0x8azFVTIpZHamQf0XosGot8tBzwmiilfgw=; b=FGg7CnjFpBAZfUCSQx5RMJTy8Xe81gVZVfbBBmjdSRjlfj0T+46GiOSo5Ra8MY4MOB djIcg/3jhJHDyFLtbG23FbxwjN1LmZuWy8LsRTu+me7TzUoxn8bLIkMvX7Rei+JBIRNm KgLvZ+oV4XFbHLfVxjmWwQLTGCF3LL8S8/j2c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=jZ/rXmRZsBKaZ7wiYL+tRZH8azkXkaaiit0qEntNKX9L81zMoB4AZzV2fA7lDytKjx xjDOXwjA1YLzJGpJpVvF6RF7oShyi+Wxb9gPGd6IJROm+f/JYYJV5jY2vgCqNfJCZwM3 cbGGXCh8fBsSNx8tiF7ExfH+3ckYAFSJIn67M= MIME-Version: 1.0 Received: by 10.229.238.148 with SMTP id ks20mr6628454qcb.78.1293072297811; Wed, 22 Dec 2010 18:44:57 -0800 (PST) Sender: amdragon@gmail.com Received: by 10.229.97.143 with HTTP; Wed, 22 Dec 2010 18:44:57 -0800 (PST) In-Reply-To: <1291928396-27937-3-git-send-email-amdragon@mit.edu> References: <1291928396-27937-1-git-send-email-amdragon@mit.edu> <1291928396-27937-3-git-send-email-amdragon@mit.edu> Date: Wed, 22 Dec 2010 21:44:57 -0500 X-Google-Sender-Auth: Va4BIMMVpA-5JuHOeQKQIzsU2GI Message-ID: Subject: Re: [PATCH 2/5] Implement an internal generic string list and use it. From: Austin Clements To: notmuch@notmuchmail.org Content-Type: multipart/alternative; boundary=00163646b8eefade4004980adad9 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: Thu, 23 Dec 2010 02:45:01 -0000 --00163646b8eefade4004980adad9 Content-Type: text/plain; charset=ISO-8859-1 It seems I somehow repeated the function prototypes for tags.c and filenames.c twice at the bottom of notmuch-private.h (probably through some rebase mishap). Obviously those should be deduplicated. On Thu, Dec 9, 2010 at 3:59 PM, Austin Clements wrote: > diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h > index 303aeb3..b6f1095 100644 > --- a/lib/notmuch-private.h > +++ b/lib/notmuch-private.h > @@ -453,48 +453,60 @@ notmuch_sha1_of_string (const char *str); > char * > notmuch_sha1_of_file (const char *filename); > > -/* tags.c */ > +/* strings.c */ > > -notmuch_tags_t * > -_notmuch_tags_create (void *ctx); > +typedef struct _notmuch_string_node { > + char *string; > + struct _notmuch_string_node *next; > +} notmuch_string_node_t; > + > +typedef struct _notmuch_string_list { > + int length; > + notmuch_string_node_t *head; > + notmuch_string_node_t **tail; > +} notmuch_string_list_t; > > +notmuch_string_list_t * > +_notmuch_string_list_create (const void *ctx); > + > +/* Add 'string' to 'list'. > + * > + * The list will create its own talloced copy of 'string'. > + */ > void > -_notmuch_tags_add_tag (notmuch_tags_t *tags, const char *tag); > +_notmuch_string_list_append (notmuch_string_list_t *list, > + const char *string); > > void > -_notmuch_tags_prepare_iterator (notmuch_tags_t *tags); > +_notmuch_string_list_sort (notmuch_string_list_t *list); > > -/* filenames.c */ > +/* tags.c */ > + > +notmuch_tags_t * > +_notmuch_tags_create (const void *ctx, notmuch_string_list_t *list, > + notmuch_bool_t steal); > > -typedef struct _notmuch_filename_node { > - char *filename; > - struct _notmuch_filename_node *next; > -} notmuch_filename_node_t; > +/* filenames.c */ > > -typedef struct _notmuch_filename_list { > - notmuch_filename_node_t *head; > - notmuch_filename_node_t **tail; > -} notmuch_filename_list_t; > +/* The notmuch_filenames_t iterates over a notmuch_string_list_t of > + * file names */ > +notmuch_filenames_t * > +_notmuch_filenames_create (const void *ctx, > + notmuch_string_list_t *list); > > -notmuch_filename_list_t * > -_notmuch_filename_list_create (const void *ctx); > +/* tags.c */ > > -/* Add 'filename' to 'list'. > - * > - * The list will create its own talloced copy of 'filename'. > - */ > -void > -_notmuch_filename_list_add_filename (notmuch_filename_list_t *list, > - const char *filename); > +notmuch_tags_t * > +_notmuch_tags_create (const void *ctx, notmuch_string_list_t *list, > + notmuch_bool_t steal); > > -void > -_notmuch_filename_list_destroy (notmuch_filename_list_t *list); > +/* filenames.c */ > > -/* The notmuch_filenames_t is an iterator object for a > - * notmuch_filename_list_t */ > +/* The notmuch_filenames_t iterates over a notmuch_string_list_t of > + * file names */ > notmuch_filenames_t * > _notmuch_filenames_create (const void *ctx, > - notmuch_filename_list_t *list); > + notmuch_string_list_t *list); > > #pragma GCC visibility pop > --00163646b8eefade4004980adad9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable It seems I somehow repeated the function prototypes for tags.c and filename= s.c twice at the bottom of notmuch-private.h (probably through some rebase = mishap). =A0Obviously those should be deduplicated.

On Thu, Dec 9, 2010 at 3:59 PM, Austin Clements <amdragon@mit.edu> wrote:
diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h
index 303aeb3..b6f1095 100644
--- a/lib/notmuch-private.h
+++ b/lib/notmuch-private.h
@@ -453,48 +453,60 @@ notmuch_sha1_of_string (const char *str);
=A0char *
=A0notmuch_sha1_of_file (const char *filename);

-/* tags.c */
+/* strings.c */

-notmuch_tags_t *
-_notmuch_tags_create (void *ctx);
+typedef struct _notmuch_string_node {
+ =A0 =A0char *string;
+ =A0 =A0struct _notmuch_string_node *next;
+} notmuch_string_node_t;
+
+typedef struct _notmuch_string_list {
+ =A0 =A0int length;
+ =A0 =A0notmuch_string_node_t *head;
+ =A0 =A0notmuch_string_node_t **tail;
+} notmuch_string_list_t;

+notmuch_string_list_t *
+_notmuch_string_list_create (const void *ctx);
+
+/* Add 'string' to 'list'.
+ *
+ * The list will create its own talloced copy of 'string'.
+ */
=A0void
-_notmuch_tags_add_tag (notmuch_tags_t *tags, const char *tag);
+_notmuch_string_list_append (notmuch_string_list_t *list,
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0const char *string= );

=A0void
-_notmuch_tags_prepare_iterator (notmuch_tags_t *tags);
+_notmuch_string_list_sort (notmuch_string_list_t *list);

-/* filenames.c */
+/* tags.c */
+
+notmuch_tags_t *
+_notmuch_tags_create (const void *ctx, notmuch_string_list_t *list,
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 notmuch_bool_t steal);

-typedef struct _notmuch_filename_node {
- =A0 =A0char *filename;
- =A0 =A0struct _notmuch_filename_node *next;
-} notmuch_filename_node_t;
+/* filenames.c */

-typedef struct _notmuch_filename_list {
- =A0 =A0notmuch_filename_node_t *head;
- =A0 =A0notmuch_filename_node_t **tail;
-} notmuch_filename_list_t;
+/* The notmuch_filenames_t iterates over a notmuch_string_list_t of
+ * file names */
+notmuch_filenames_t *
+_notmuch_filenames_create (const void *ctx,
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0notmuch_string_list_t = *list);

-notmuch_filename_list_t *
-_notmuch_filename_list_create (const void *ctx);
+/* tags.c */

-/* Add 'filename' to 'list'.
- *
- * The list will create its own talloced copy of 'filename'.
- */
-void
-_notmuch_filename_list_add_filename (notmuch_filename_list_t *list,
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0co= nst char *filename);
+notmuch_tags_t *
+_notmuch_tags_create (const void *ctx, notmuch_string_list_t *list,
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 notmuch_bool_t steal);

-void
-_notmuch_filename_list_destroy (notmuch_filename_list_t *list);
+/* filenames.c */

-/* The notmuch_filenames_t is an iterator object for a
- * notmuch_filename_list_t */
+/* The notmuch_filenames_t iterates over a notmuch_string_list_t of
+ * file names */
=A0notmuch_filenames_t *
=A0_notmuch_filenames_create (const void *ctx,
- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0notmuch_filename_list_= t *list);
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0notmuch_string_list_t = *list);

=A0#pragma GCC visibility pop
--00163646b8eefade4004980adad9--