Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 57 / c2e65362b0fa711823f0911f009620ecc7c50b
1 Return-Path: <david@tethera.net>\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 arlo.cworth.org (Postfix) with ESMTP id E4EFB6DE0B7C\r
6  for <notmuch@notmuchmail.org>; Thu, 24 Sep 2015 16:33:39 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at cworth.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.484\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.484 tagged_above=-999 required=5 tests=[AWL=-0.260,\r
12   URIBL_SBL=0.644, URIBL_SBL_A=0.1] autolearn=disabled\r
13 Received: from arlo.cworth.org ([127.0.0.1])\r
14  by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
15  with ESMTP id 2ba2859Zgt4k for <notmuch@notmuchmail.org>;\r
16  Thu, 24 Sep 2015 16:33:37 -0700 (PDT)\r
17 Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224])\r
18  by arlo.cworth.org (Postfix) with ESMTPS id 16D086DE0B64\r
19  for <notmuch@notmuchmail.org>; Thu, 24 Sep 2015 16:33:37 -0700 (PDT)\r
20 Received: from remotemail by gitolite.debian.net with local (Exim 4.80)\r
21  (envelope-from <david@tethera.net>)\r
22  id 1ZfFzR-0000ih-Eh; Thu, 24 Sep 2015 23:31:49 +0000\r
23 Received: (nullmailer pid 21587 invoked by uid 1000); Thu, 24 Sep 2015\r
24  23:31:30 -0000\r
25 From: David Bremner <david@tethera.net>\r
26 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
27 Subject: Re: [PATCH v2 6/9] cli: change the data structure for notmuch\r
28  address deduplication\r
29 In-Reply-To: <87612zwts9.fsf@nikula.org>\r
30 References: <cover.1441308761.git.jani@nikula.org>\r
31  <d8bb01aff648f9b73ec5f09f0e86e42dac2a21a6.1441308761.git.jani@nikula.org>\r
32  <87fv242e2a.fsf@zancas.localnet> <87612zwts9.fsf@nikula.org>\r
33 User-Agent: Notmuch/0.20.2+73~gd432116 (http://notmuchmail.org) Emacs/24.5.1\r
34  (x86_64-pc-linux-gnu)\r
35 Date: Thu, 24 Sep 2015 20:31:30 -0300\r
36 Message-ID: <878u7v2y3x.fsf@zancas.localnet>\r
37 MIME-Version: 1.0\r
38 Content-Type: text/plain\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.18\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43  <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45  <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50  <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Thu, 24 Sep 2015 23:33:40 -0000\r
52 \r
53 Jani Nikula <jani@nikula.org> writes:\r
54 \r
55 > On Thu, 24 Sep 2015, David Bremner <david@tethera.net> wrote:\r
56 >> Jani Nikula <jani@nikula.org> writes:\r
57 >>\r
58 >>\r
59 >>> +    else\r
60 >>> +   v = !!m1->name - !!m2->name;\r
61 >>\r
62 >> Is this really idiomatic? It seems a little difficult to follow to me.\r
63 >\r
64 > Probably depends on whether you're accustomed to using !! for\r
65 > "normalizing" zero and non-zero to 0 and 1, respectively.\r
66 >\r
67 > The alternative seemed a bit too verbose for my liking:\r
68 >\r
69 >     if (m1->name && m2->name)\r
70 >         v = strcmp (m1->name, m2->name);\r
71 >     else if (!m1->name && !m2->name)\r
72 >         v = 0;\r
73 >     else if (m1->name)\r
74 >         v = 1;\r
75 >     else\r
76 >         v = -1;\r
77 >\r
78 \r
79 What about adding the verbose version to string-util.c as\r
80 e.g. strcmp_null. Theres apparently similar functions in the linux\r
81 kernel, gnome-vfs, subversion...\r
82 \r
83 https://codesearch.debian.net/results/strcmp_null/page_0\r
84 \r
85 \r
86 \r