1 Return-Path: <amdragon@mit.edu>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 18317431FAF
\r
6 for <notmuch@notmuchmail.org>; Sat, 8 Sep 2012 10:24:27 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id FNO36cWvF36A for <notmuch@notmuchmail.org>;
\r
16 Sat, 8 Sep 2012 10:24:26 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 0EF40431FBD
\r
20 for <notmuch@notmuchmail.org>; Sat, 8 Sep 2012 10:24:25 -0700 (PDT)
\r
21 X-AuditID: 1209190f-b7f706d0000008d5-d8-504b7f492385
\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])
\r
23 by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id E8.A7.02261.94F7B405; Sat, 8 Sep 2012 13:24:25 -0400 (EDT)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id q88HOOEa020240;
\r
27 Sat, 8 Sep 2012 13:24:25 -0400
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q88HONeR026350
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Sat, 8 Sep 2012 13:24:24 -0400 (EDT)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1TAOlb-00061d-7p; Sat, 08 Sep 2012 13:24:23 -0400
\r
37 Date: Sat, 8 Sep 2012 13:24:23 -0400
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: Jameson Graef Rollins <jrollins@finestructure.net>
\r
40 Subject: Re: [PATCH 02/11] lib: use new addresses structure for thread authors
\r
41 Message-ID: <20120908172423.GA22117@mit.edu>
\r
42 References: <1345427570-26518-1-git-send-email-jrollins@finestructure.net>
\r
43 <1345427570-26518-2-git-send-email-jrollins@finestructure.net>
\r
44 <1345427570-26518-3-git-send-email-jrollins@finestructure.net>
\r
46 Content-Type: text/plain; charset=us-ascii
\r
47 Content-Disposition: inline
\r
48 In-Reply-To: <1345427570-26518-3-git-send-email-jrollins@finestructure.net>
\r
49 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
50 X-Brightmail-Tracker:
\r
51 H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42IRYrdT1/Ws9w4waHqmbLFnn5fF9ZszmR2Y
\r
52 PO6e5vJ4tuoWcwBTFJdNSmpOZllqkb5dAlfG1ZMdzAXrlCom7TrI1MD4WKqLkZNDQsBE4u6C
\r
53 l6wQtpjEhXvr2boYuTiEBPYxSuy7sZEFwlnPKPFl5h4o5wSTxKe+3awQzhJGiebG2Swg/SwC
\r
54 KhKnv99lA7HZBDQktu1fzghiiwiYSfR8+QNmMwtoSWzd+AHMFhbwk/j+eRY7iM0roCMx6/Ic
\r
55 ZoihZxglmvavgkoISpyc+YQFpvnGv5dMXYwcQLa0xPJ/HCBhTgFviWu3PoCViALdMOXkNrYJ
\r
56 jEKzkHTPQtI9C6F7ASPzKkbZlNwq3dzEzJzi1GTd4uTEvLzUIl0TvdzMEr3UlNJNjKCw5pTk
\r
57 38H47aDSIUYBDkYlHt4Ncl4BQqyJZcWVuYcYJTmYlER5d9d4BwjxJeWnVGYkFmfEF5XmpBYf
\r
58 YpTgYFYS4b2eDpTjTUmsrEotyodJSXOwKInzXk256S8kkJ5YkpqdmlqQWgSTleHgUJLgta0D
\r
59 ahQsSk1PrUjLzClBSDNxcIIM5wEabgxSw1tckJhbnJkOkT/FqCglzusNcpEASCKjNA+uF5Z2
\r
60 XjGKA70iDLGCB5iy4LpfAQ1mAhos8swDZHBJIkJKqoHRvJPnRPqmZepFlXeb98d/3hofWxZ2
\r
61 syrvTfE19VmzxbZ0u9zJDDi8mI1z268olb+NGkZTLINXijl/O3MoRENiuYejjsZ0Mdl1R/X3
\r
62 GYf0H4md+vO36Te1/vp3JhOTZb9xBZgqXj81/dvT3ZUZrQGGQbHvNjA7fA/dLebxwUg/KNYl
\r
63 /eOuSyVKLMUZiYZazEXFiQBk9+zbFgMAAA==
\r
64 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
65 X-BeenThere: notmuch@notmuchmail.org
\r
66 X-Mailman-Version: 2.1.13
\r
68 List-Id: "Use and development of the notmuch mail system."
\r
69 <notmuch.notmuchmail.org>
\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
71 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
73 List-Post: <mailto:notmuch@notmuchmail.org>
\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
76 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
77 X-List-Received-Date: Sat, 08 Sep 2012 17:24:27 -0000
\r
79 Quoth Jameson Graef Rollins on Aug 19 at 6:52 pm:
\r
80 > Now that we have the infrastructure in place, we modify the thread
\r
81 > object and associated functions to use the new addresses structure for
\r
82 > storing thread authors.
\r
84 > lib/thread.cc | 41 +++++++++++------------------------------
\r
85 > 1 file changed, 11 insertions(+), 30 deletions(-)
\r
87 > diff --git a/lib/thread.cc b/lib/thread.cc
\r
88 > index 7af9eeb..9e0e5cb 100644
\r
89 > --- a/lib/thread.cc
\r
90 > +++ b/lib/thread.cc
\r
91 > @@ -36,11 +36,7 @@ struct visible _notmuch_thread {
\r
92 > notmuch_database_t *notmuch;
\r
95 > - GHashTable *authors_hash;
\r
96 > - GPtrArray *authors_array;
\r
97 > - GHashTable *matched_authors_hash;
\r
98 > - GPtrArray *matched_authors_array;
\r
100 > + notmuch_thread_addresses_t *authors;
\r
101 > GHashTable *tags;
\r
103 > notmuch_message_list_t *message_list;
\r
104 > @@ -66,21 +62,9 @@ _notmuch_thread_addresses_destructor (notmuch_thread_addresses_t *addresses)
\r
106 > _notmuch_thread_destructor (notmuch_thread_t *thread)
\r
108 > - g_hash_table_unref (thread->authors_hash);
\r
109 > - g_hash_table_unref (thread->matched_authors_hash);
\r
110 > + _notmuch_thread_addresses_destructor (thread->authors);
\r
112 This is the explicit call I mentioned in my talloc destructor comment
\r
115 > g_hash_table_unref (thread->tags);
\r
116 > g_hash_table_unref (thread->message_hash);
\r
118 > - if (thread->authors_array) {
\r
119 > - g_ptr_array_free (thread->authors_array, TRUE);
\r
120 > - thread->authors_array = NULL;
\r
123 > - if (thread->matched_authors_array) {
\r
124 > - g_ptr_array_free (thread->matched_authors_array, TRUE);
\r
125 > - thread->matched_authors_array = NULL;
\r
131 > @@ -341,7 +325,7 @@ _thread_add_message (notmuch_thread_t *thread,
\r
132 > author = internet_address_mailbox_get_addr (mailbox);
\r
134 > clean_author = _thread_cleanup_author (thread, author, from);
\r
135 > - _thread_add_author (thread, clean_author);
\r
136 > + _thread_add_address (thread->authors, clean_author, FALSE);
\r
137 > notmuch_message_set_author (message, clean_author);
\r
139 > g_object_unref (G_OBJECT (list));
\r
140 > @@ -436,7 +420,7 @@ _thread_add_matched_message (notmuch_thread_t *thread,
\r
141 > NOTMUCH_MESSAGE_FLAG_MATCH, 1);
\r
144 > - _thread_add_matched_author (thread, notmuch_message_get_author (hashed_message));
\r
145 > + _thread_add_address (thread->authors, notmuch_message_get_author (hashed_message), TRUE);
\r
149 > @@ -555,14 +539,11 @@ _notmuch_thread_create (void *ctx,
\r
150 > thread->notmuch = notmuch;
\r
151 > thread->thread_id = talloc_strdup (thread, thread_id);
\r
152 > thread->subject = NULL;
\r
153 > - thread->authors_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
\r
155 > - thread->authors_array = g_ptr_array_new ();
\r
156 > - thread->matched_authors_hash = g_hash_table_new_full (g_str_hash,
\r
159 > - thread->matched_authors_array = g_ptr_array_new ();
\r
160 > - thread->authors = NULL;
\r
162 > + thread->authors = _thread_addresses_init (thread);
\r
163 > + if (unlikely (thread->authors == NULL))
\r
166 > thread->tags = g_hash_table_new_full (g_str_hash, g_str_equal,
\r
169 > @@ -607,7 +588,7 @@ _notmuch_thread_create (void *ctx,
\r
171 > notmuch_query_destroy (thread_id_query);
\r
173 > - _resolve_thread_authors_string (thread);
\r
174 > + _resolve_thread_addresses_string (thread->authors);
\r
176 If you make my suggested change to the
\r
177 _resolve_thread_addresses_string API, this call would simply go
\r
181 > _resolve_thread_relationships (thread);
\r
183 > @@ -641,7 +622,7 @@ notmuch_thread_get_matched_messages (notmuch_thread_t *thread)
\r
185 > notmuch_thread_get_authors (notmuch_thread_t *thread)
\r
187 > - return thread->authors;
\r
188 > + return thread->authors->string;
\r
190 ... and this would be return _thread_addresses_to_string (or
\r
198 Austin Clements MIT/'06/PhD/CSAIL
\r
199 amdragon@mit.edu http://web.mit.edu/amdragon
\r
200 Somewhere in the dream we call reality you will find me,
\r
201 searching for the reality we call dreams.
\r