From d70deb1f7b6d19293ef4818409f7349d83dee077 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Fri, 25 Sep 2015 20:31:30 +2100 Subject: [PATCH] Re: [PATCH v2 6/9] cli: change the data structure for notmuch address deduplication --- 57/c2e65362b0fa711823f0911f009620ecc7c50b | 86 +++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 57/c2e65362b0fa711823f0911f009620ecc7c50b diff --git a/57/c2e65362b0fa711823f0911f009620ecc7c50b b/57/c2e65362b0fa711823f0911f009620ecc7c50b new file mode 100644 index 000000000..abff077cc --- /dev/null +++ b/57/c2e65362b0fa711823f0911f009620ecc7c50b @@ -0,0 +1,86 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id E4EFB6DE0B7C + for ; Thu, 24 Sep 2015 16:33:39 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0.484 +X-Spam-Level: +X-Spam-Status: No, score=0.484 tagged_above=-999 required=5 tests=[AWL=-0.260, + URIBL_SBL=0.644, URIBL_SBL_A=0.1] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 2ba2859Zgt4k for ; + Thu, 24 Sep 2015 16:33:37 -0700 (PDT) +Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224]) + by arlo.cworth.org (Postfix) with ESMTPS id 16D086DE0B64 + for ; Thu, 24 Sep 2015 16:33:37 -0700 (PDT) +Received: from remotemail by gitolite.debian.net with local (Exim 4.80) + (envelope-from ) + id 1ZfFzR-0000ih-Eh; Thu, 24 Sep 2015 23:31:49 +0000 +Received: (nullmailer pid 21587 invoked by uid 1000); Thu, 24 Sep 2015 + 23:31:30 -0000 +From: David Bremner +To: Jani Nikula , notmuch@notmuchmail.org +Subject: Re: [PATCH v2 6/9] cli: change the data structure for notmuch + address deduplication +In-Reply-To: <87612zwts9.fsf@nikula.org> +References: + + <87fv242e2a.fsf@zancas.localnet> <87612zwts9.fsf@nikula.org> +User-Agent: Notmuch/0.20.2+73~gd432116 (http://notmuchmail.org) Emacs/24.5.1 + (x86_64-pc-linux-gnu) +Date: Thu, 24 Sep 2015 20:31:30 -0300 +Message-ID: <878u7v2y3x.fsf@zancas.localnet> +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +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, 24 Sep 2015 23:33:40 -0000 + +Jani Nikula writes: + +> On Thu, 24 Sep 2015, David Bremner wrote: +>> Jani Nikula writes: +>> +>> +>>> + else +>>> + v = !!m1->name - !!m2->name; +>> +>> Is this really idiomatic? It seems a little difficult to follow to me. +> +> Probably depends on whether you're accustomed to using !! for +> "normalizing" zero and non-zero to 0 and 1, respectively. +> +> The alternative seemed a bit too verbose for my liking: +> +> if (m1->name && m2->name) +> v = strcmp (m1->name, m2->name); +> else if (!m1->name && !m2->name) +> v = 0; +> else if (m1->name) +> v = 1; +> else +> v = -1; +> + +What about adding the verbose version to string-util.c as +e.g. strcmp_null. Theres apparently similar functions in the linux +kernel, gnome-vfs, subversion... + +https://codesearch.debian.net/results/strcmp_null/page_0 + + + -- 2.26.2