Re: [PATCH 2/5] Implement an internal generic string list and use it.
authorAustin Clements <amdragon@mit.edu>
Thu, 23 Dec 2010 02:44:57 +0000 (21:44 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:37:41 +0000 (09:37 -0800)
da/e9fc696e90d2f70c19fe426fc3c37bdcc20e7e [new file with mode: 0644]

diff --git a/da/e9fc696e90d2f70c19fe426fc3c37bdcc20e7e b/da/e9fc696e90d2f70c19fe426fc3c37bdcc20e7e
new file mode 100644 (file)
index 0000000..d04e3f0
--- /dev/null
@@ -0,0 +1,280 @@
+Return-Path: <amdragon@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id D3269431FD0\r
+       for <notmuch@notmuchmail.org>; Wed, 22 Dec 2010 18:45:00 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.698\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.698 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001,\r
+       HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id r8sgxa3UpzBG for <notmuch@notmuchmail.org>;\r
+       Wed, 22 Dec 2010 18:45:00 -0800 (PST)\r
+Received: from mail-qw0-f53.google.com (mail-qw0-f53.google.com\r
+       [209.85.216.53])\r
+       by olra.theworths.org (Postfix) with ESMTP id 056A5431FB6\r
+       for <notmuch@notmuchmail.org>; Wed, 22 Dec 2010 18:44:59 -0800 (PST)\r
+Received: by qwe5 with SMTP id 5so6270175qwe.26\r
+       for <notmuch@notmuchmail.org>; Wed, 22 Dec 2010 18:44:57 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=domainkey-signature:mime-version:received:sender:received\r
+       :in-reply-to:references:date:x-google-sender-auth:message-id:subject\r
+       :from:to:content-type;\r
+       bh=r17eUEsp0x8azFVTIpZHamQf0XosGot8tBzwmiilfgw=;\r
+       b=FGg7CnjFpBAZfUCSQx5RMJTy8Xe81gVZVfbBBmjdSRjlfj0T+46GiOSo5Ra8MY4MOB\r
+       djIcg/3jhJHDyFLtbG23FbxwjN1LmZuWy8LsRTu+me7TzUoxn8bLIkMvX7Rei+JBIRNm\r
+       KgLvZ+oV4XFbHLfVxjmWwQLTGCF3LL8S8/j2c=\r
+DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
+       h=mime-version:sender:in-reply-to:references:date\r
+       :x-google-sender-auth:message-id:subject:from:to:content-type;\r
+       b=jZ/rXmRZsBKaZ7wiYL+tRZH8azkXkaaiit0qEntNKX9L81zMoB4AZzV2fA7lDytKjx\r
+       xjDOXwjA1YLzJGpJpVvF6RF7oShyi+Wxb9gPGd6IJROm+f/JYYJV5jY2vgCqNfJCZwM3\r
+       cbGGXCh8fBsSNx8tiF7ExfH+3ckYAFSJIn67M=\r
+MIME-Version: 1.0\r
+Received: by 10.229.238.148 with SMTP id ks20mr6628454qcb.78.1293072297811;\r
+       Wed, 22 Dec 2010 18:44:57 -0800 (PST)\r
+Sender: amdragon@gmail.com\r
+Received: by 10.229.97.143 with HTTP; Wed, 22 Dec 2010 18:44:57 -0800 (PST)\r
+In-Reply-To: <1291928396-27937-3-git-send-email-amdragon@mit.edu>\r
+References: <1291928396-27937-1-git-send-email-amdragon@mit.edu>\r
+       <1291928396-27937-3-git-send-email-amdragon@mit.edu>\r
+Date: Wed, 22 Dec 2010 21:44:57 -0500\r
+X-Google-Sender-Auth: Va4BIMMVpA-5JuHOeQKQIzsU2GI\r
+Message-ID: <AANLkTi=W63D_F6+3AJ553vZ8aV1xO9Uz6vAagxsP5c5V@mail.gmail.com>\r
+Subject: Re: [PATCH 2/5] Implement an internal generic string list and use it.\r
+From: Austin Clements <amdragon@mit.edu>\r
+To: notmuch@notmuchmail.org\r
+Content-Type: multipart/alternative; boundary=00163646b8eefade4004980adad9\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 23 Dec 2010 02:45:01 -0000\r
+\r
+--00163646b8eefade4004980adad9\r
+Content-Type: text/plain; charset=ISO-8859-1\r
+\r
+It seems I somehow repeated the function prototypes for tags.c and\r
+filenames.c twice at the bottom of notmuch-private.h (probably through some\r
+rebase mishap).  Obviously those should be deduplicated.\r
+\r
+On Thu, Dec 9, 2010 at 3:59 PM, Austin Clements <amdragon@mit.edu> wrote:\r
+\r
+> diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h\r
+> index 303aeb3..b6f1095 100644\r
+> --- a/lib/notmuch-private.h\r
+> +++ b/lib/notmuch-private.h\r
+> @@ -453,48 +453,60 @@ notmuch_sha1_of_string (const char *str);\r
+>  char *\r
+>  notmuch_sha1_of_file (const char *filename);\r
+>\r
+> -/* tags.c */\r
+> +/* strings.c */\r
+>\r
+> -notmuch_tags_t *\r
+> -_notmuch_tags_create (void *ctx);\r
+> +typedef struct _notmuch_string_node {\r
+> +    char *string;\r
+> +    struct _notmuch_string_node *next;\r
+> +} notmuch_string_node_t;\r
+> +\r
+> +typedef struct _notmuch_string_list {\r
+> +    int length;\r
+> +    notmuch_string_node_t *head;\r
+> +    notmuch_string_node_t **tail;\r
+> +} notmuch_string_list_t;\r
+>\r
+> +notmuch_string_list_t *\r
+> +_notmuch_string_list_create (const void *ctx);\r
+> +\r
+> +/* Add 'string' to 'list'.\r
+> + *\r
+> + * The list will create its own talloced copy of 'string'.\r
+> + */\r
+>  void\r
+> -_notmuch_tags_add_tag (notmuch_tags_t *tags, const char *tag);\r
+> +_notmuch_string_list_append (notmuch_string_list_t *list,\r
+> +                            const char *string);\r
+>\r
+>  void\r
+> -_notmuch_tags_prepare_iterator (notmuch_tags_t *tags);\r
+> +_notmuch_string_list_sort (notmuch_string_list_t *list);\r
+>\r
+> -/* filenames.c */\r
+> +/* tags.c */\r
+> +\r
+> +notmuch_tags_t *\r
+> +_notmuch_tags_create (const void *ctx, notmuch_string_list_t *list,\r
+> +                     notmuch_bool_t steal);\r
+>\r
+> -typedef struct _notmuch_filename_node {\r
+> -    char *filename;\r
+> -    struct _notmuch_filename_node *next;\r
+> -} notmuch_filename_node_t;\r
+> +/* filenames.c */\r
+>\r
+> -typedef struct _notmuch_filename_list {\r
+> -    notmuch_filename_node_t *head;\r
+> -    notmuch_filename_node_t **tail;\r
+> -} notmuch_filename_list_t;\r
+> +/* The notmuch_filenames_t iterates over a notmuch_string_list_t of\r
+> + * file names */\r
+> +notmuch_filenames_t *\r
+> +_notmuch_filenames_create (const void *ctx,\r
+> +                          notmuch_string_list_t *list);\r
+>\r
+> -notmuch_filename_list_t *\r
+> -_notmuch_filename_list_create (const void *ctx);\r
+> +/* tags.c */\r
+>\r
+> -/* Add 'filename' to 'list'.\r
+> - *\r
+> - * The list will create its own talloced copy of 'filename'.\r
+> - */\r
+> -void\r
+> -_notmuch_filename_list_add_filename (notmuch_filename_list_t *list,\r
+> -                                    const char *filename);\r
+> +notmuch_tags_t *\r
+> +_notmuch_tags_create (const void *ctx, notmuch_string_list_t *list,\r
+> +                     notmuch_bool_t steal);\r
+>\r
+> -void\r
+> -_notmuch_filename_list_destroy (notmuch_filename_list_t *list);\r
+> +/* filenames.c */\r
+>\r
+> -/* The notmuch_filenames_t is an iterator object for a\r
+> - * notmuch_filename_list_t */\r
+> +/* The notmuch_filenames_t iterates over a notmuch_string_list_t of\r
+> + * file names */\r
+>  notmuch_filenames_t *\r
+>  _notmuch_filenames_create (const void *ctx,\r
+> -                          notmuch_filename_list_t *list);\r
+> +                          notmuch_string_list_t *list);\r
+>\r
+>  #pragma GCC visibility pop\r
+>\r
+\r
+--00163646b8eefade4004980adad9\r
+Content-Type: text/html; charset=ISO-8859-1\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+It seems I somehow repeated the function prototypes for tags.c and filename=\r
+s.c twice at the bottom of notmuch-private.h (probably through some rebase =\r
+mishap). =A0Obviously those should be deduplicated.<br><br><div class=3D"gm=\r
+ail_quote">\r
+On Thu, Dec 9, 2010 at 3:59 PM, Austin Clements <span dir=3D"ltr">&lt;<a hr=\r
+ef=3D"mailto:amdragon@mit.edu">amdragon@mit.edu</a>&gt;</span> wrote:<br><b=\r
+lockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px =\r
+#ccc solid;padding-left:1ex;">\r
+diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h<br>\r
+index 303aeb3..b6f1095 100644<br>\r
+--- a/lib/notmuch-private.h<br>\r
++++ b/lib/notmuch-private.h<br>\r
+@@ -453,48 +453,60 @@ notmuch_sha1_of_string (const char *str);<br>\r
+=A0char *<br>\r
+=A0notmuch_sha1_of_file (const char *filename);<br>\r
+<br>\r
+-/* tags.c */<br>\r
++/* strings.c */<br>\r
+<br>\r
+-notmuch_tags_t *<br>\r
+-_notmuch_tags_create (void *ctx);<br>\r
++typedef struct _notmuch_string_node {<br>\r
++ =A0 =A0char *string;<br>\r
++ =A0 =A0struct _notmuch_string_node *next;<br>\r
++} notmuch_string_node_t;<br>\r
++<br>\r
++typedef struct _notmuch_string_list {<br>\r
++ =A0 =A0int length;<br>\r
++ =A0 =A0notmuch_string_node_t *head;<br>\r
++ =A0 =A0notmuch_string_node_t **tail;<br>\r
++} notmuch_string_list_t;<br>\r
+<br>\r
++notmuch_string_list_t *<br>\r
++_notmuch_string_list_create (const void *ctx);<br>\r
++<br>\r
++/* Add &#39;string&#39; to &#39;list&#39;.<br>\r
++ *<br>\r
++ * The list will create its own talloced copy of &#39;string&#39;.<br>\r
++ */<br>\r
+=A0void<br>\r
+-_notmuch_tags_add_tag (notmuch_tags_t *tags, const char *tag);<br>\r
++_notmuch_string_list_append (notmuch_string_list_t *list,<br>\r
++ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0const char *string=\r
+);<br>\r
+<br>\r
+=A0void<br>\r
+-_notmuch_tags_prepare_iterator (notmuch_tags_t *tags);<br>\r
++_notmuch_string_list_sort (notmuch_string_list_t *list);<br>\r
+<br>\r
+-/* filenames.c */<br>\r
++/* tags.c */<br>\r
++<br>\r
++notmuch_tags_t *<br>\r
++_notmuch_tags_create (const void *ctx, notmuch_string_list_t *list,<br>\r
++ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 notmuch_bool_t steal);<br>\r
+<br>\r
+-typedef struct _notmuch_filename_node {<br>\r
+- =A0 =A0char *filename;<br>\r
+- =A0 =A0struct _notmuch_filename_node *next;<br>\r
+-} notmuch_filename_node_t;<br>\r
++/* filenames.c */<br>\r
+<br>\r
+-typedef struct _notmuch_filename_list {<br>\r
+- =A0 =A0notmuch_filename_node_t *head;<br>\r
+- =A0 =A0notmuch_filename_node_t **tail;<br>\r
+-} notmuch_filename_list_t;<br>\r
++/* The notmuch_filenames_t iterates over a notmuch_string_list_t of<br>\r
++ * file names */<br>\r
++notmuch_filenames_t *<br>\r
++_notmuch_filenames_create (const void *ctx,<br>\r
++ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0notmuch_string_list_t =\r
+*list);<br>\r
+<br>\r
+-notmuch_filename_list_t *<br>\r
+-_notmuch_filename_list_create (const void *ctx);<br>\r
++/* tags.c */<br>\r
+<br>\r
+-/* Add &#39;filename&#39; to &#39;list&#39;.<br>\r
+- *<br>\r
+- * The list will create its own talloced copy of &#39;filename&#39;.<br>\r
+- */<br>\r
+-void<br>\r
+-_notmuch_filename_list_add_filename (notmuch_filename_list_t *list,<br>\r
+- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0co=\r
+nst char *filename);<br>\r
++notmuch_tags_t *<br>\r
++_notmuch_tags_create (const void *ctx, notmuch_string_list_t *list,<br>\r
++ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 notmuch_bool_t steal);<br>\r
+<br>\r
+-void<br>\r
+-_notmuch_filename_list_destroy (notmuch_filename_list_t *list);<br>\r
++/* filenames.c */<br>\r
+<br>\r
+-/* The notmuch_filenames_t is an iterator object for a<br>\r
+- * notmuch_filename_list_t */<br>\r
++/* The notmuch_filenames_t iterates over a notmuch_string_list_t of<br>\r
++ * file names */<br>\r
+=A0notmuch_filenames_t *<br>\r
+=A0_notmuch_filenames_create (const void *ctx,<br>\r
+- =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0notmuch_filename_list_=\r
+t *list);<br>\r
++ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0notmuch_string_list_t =\r
+*list);<br>\r
+<br>\r
+=A0#pragma GCC visibility pop<br></blockquote></div>\r
+\r
+--00163646b8eefade4004980adad9--\r