From: David Bremner Date: Sat, 30 Apr 2016 11:53:52 +0000 (+2100) Subject: Re: [Patch v2 04/13] lib/cli: add library API / CLI for compile time options X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1980829ed8feb22754c55d1865c5f199a9924fbc;p=notmuch-archives.git Re: [Patch v2 04/13] lib/cli: add library API / CLI for compile time options --- diff --git a/92/018fd63ea24b9a3d8a34a9125a0a31910bce5b b/92/018fd63ea24b9a3d8a34a9125a0a31910bce5b new file mode 100644 index 000000000..179156d9f --- /dev/null +++ b/92/018fd63ea24b9a3d8a34a9125a0a31910bce5b @@ -0,0 +1,107 @@ +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 B03706DE034D + for ; Sat, 30 Apr 2016 04:54:05 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.015 +X-Spam-Level: +X-Spam-Status: No, score=-0.015 tagged_above=-999 required=5 + tests=[AWL=-0.004, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] + 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 l4n0nQWwS4KZ for ; + Sat, 30 Apr 2016 04:53:57 -0700 (PDT) +Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) + by arlo.cworth.org (Postfix) with ESMTPS id C5F6C6DE0022 + for ; Sat, 30 Apr 2016 04:53:57 -0700 (PDT) +Received: from remotemail by fethera.tethera.net with local (Exim 4.84) + (envelope-from ) + id 1awTT4-0005Jc-3b; Sat, 30 Apr 2016 07:53:50 -0400 +Received: (nullmailer pid 5396 invoked by uid 1000); + Sat, 30 Apr 2016 11:53:52 -0000 +From: David Bremner +To: Tomi Ollila , notmuch@notmuchmail.org +Subject: Re: [Patch v2 04/13] lib/cli: add library API / CLI for compile time + options +In-Reply-To: +References: <1459015043-8460-1-git-send-email-david@tethera.net> + <1459015043-8460-5-git-send-email-david@tethera.net> + +User-Agent: Notmuch/0.21+99~gd93d377 (http://notmuchmail.org) Emacs/24.5.1 + (x86_64-pc-linux-gnu) +Reply-To: me@example.com +Date: Sat, 30 Apr 2016 08:53:52 -0300 +Message-ID: <87inyz8g8f.fsf@zancas.localnet> +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +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: Sat, 30 Apr 2016 11:54:05 -0000 + +Tomi Ollila writes: + +> On Sat, Mar 26 2016, David Bremner wrote: +> +> +> notmuch_bool_t +> notmuch_options_get (const char *name) { +> if (STRNCMP_LITERAL (name, "compact") == 0) { +> return HAVE_XAPIAN_COMPACT; +> // or return HAVE_XAPIAN_COMPACT? TRUE: FALSE; +> // or return !! HAVE_XAPIAN_COMPACT; +> } else if (STRNCMP_LITERAL (name, "field_processor") == 0) { +> return HAVE_XAPIAN_FIELD_PROCESSOR; +> } else { +> return FALSE; +> } +> } + +I have no real objection to this. It's a bit slower than matching +against an enum, but I don't see this being in any performance critical +paths. + +> +> ... note: if this notmuch_options_present () function prevails, fix +> the later #if check ;D +> +> ... and +> +> void +> _notmuch_config_list_options () { +> printf("options.compact=%s\n", +> HAVE_XAPIAN_COMPACT ? "true" : "false"); +> printf("options.field_processor=%s\n", +> HAVE_XAPIAN_FIELD_PROCESSOR ? "true" : "false"); +> } +> + +This I'm not so sure about. There's a subtle distinction between what is +supported in the CLI and what is supported in the lib, and we really +want the latter. So I do think _some_ library routine is needed. + +> (kept the 'options' naming and prefix in this context) + +As far as the naming goes, I agree options is a bit weird. We could call +these things library features and the existing ones database features, +since the the latter are not really exposed to users. Other possible +words are + + trait + attribute + property + +