From: Bijan Chokoufe Nejad Date: Mon, 13 Jun 2016 15:18:07 +0000 (+0200) Subject: Re: [PATCH 2/8] lib: private string map (associative array) API X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d650a769c5d95e65edcaefc5f07d7768fe5d4c05;p=notmuch-archives.git Re: [PATCH 2/8] lib: private string map (associative array) API --- diff --git a/7d/969fc7ab2ed6b113685fcdd8cf4679185afba8 b/7d/969fc7ab2ed6b113685fcdd8cf4679185afba8 new file mode 100644 index 000000000..894098d4e --- /dev/null +++ b/7d/969fc7ab2ed6b113685fcdd8cf4679185afba8 @@ -0,0 +1,138 @@ +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 8AE4D6DE02AF + for ; Mon, 13 Jun 2016 08:18:21 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.82 +X-Spam-Level: +X-Spam-Status: No, score=-0.82 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, + RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] 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 qEB3HXpeO9VE for ; + Mon, 13 Jun 2016 08:18:12 -0700 (PDT) +Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com + [74.125.82.66]) by arlo.cworth.org (Postfix) with ESMTPS id E7FBE6DE0008 for + ; Mon, 13 Jun 2016 08:18:11 -0700 (PDT) +Received: by mail-wm0-f66.google.com with SMTP id m124so15647052wme.3 + for ; Mon, 13 Jun 2016 08:18:11 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=date:from:to:cc:subject:message-id:references:mime-version + :content-disposition:content-transfer-encoding:in-reply-to + :user-agent; bh=xRQcGOY090lr0oz1lJApX9l5BQX2YIFoUOqK2Ffw1pA=; + b=uZwWXnHZiEe9tiNPqbE0hpbImqInnAaAnaxshhulsoplA8UduveKU3MMTFiLEnyxgw + s5v4iWA4ES55XRCWWLtZCQgEavTZtyd1Fnq8dyp+xV1pnps1GWfT49s/Jf7TQyyR1wZU + bvKPQ9d291uJi8BJaxC06RgP4rCm5ukwXIQvj8VfIiJgOiwrzbjXMetsuTYL4u5fLPyC + Xm7jM2o9RDr3i3LK/gAW7NJNzyujMr4W6ZM1C4GjLzr0r19xED/e3AyTkLQxDwflY82B + J8u5wHOqElkuzHKhD7jFO0gIvszbIBc9F9P1virA+uDqtG5SrfbXij4dELyG+5s4stGb + 7SUQ== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:date:from:to:cc:subject:message-id:references + :mime-version:content-disposition:content-transfer-encoding + :in-reply-to:user-agent; + bh=xRQcGOY090lr0oz1lJApX9l5BQX2YIFoUOqK2Ffw1pA=; + b=VtGyc6nnlcXKvRQoNiK6x4TMI0DODO8IS6K0ruReH+ODXkjkr/v/fytJ2+02onaJuU + FsCB+8HyyiUhhX0gqsusFIogWJxgI66j6RHfti3z6HaXee62RPelqjYUfTOiN3x3r1eo + LXVQNsrBb6VUV+U+COacvN5/xUZfta9J0X3Q4nmPoe+3t259fqEXo1emIyM/33LVKUGD + vqIdPypa8RBuuWBMbe1PCiEDVxMCjD6yz0LGMd0EwtseBCCoDpYsDpD6B15j6i+6ykhZ + oj/RAjOwG8uOw5PFViFfTyBUG5sJ9AGaUMneqyVhmKsTcHrpU/TBpTOIFmXLdDpbpUyw + x3GA== +X-Gm-Message-State: + ALyK8tJ7LMVerG+nH2s6vNxhX7wPQj9x6rxM4CLtzfHeuBv2u9rHD9vOIb9CMJdhFSpJTw== +X-Received: by 10.28.48.15 with SMTP id w15mr156639wmw.28.1465831090024; + Mon, 13 Jun 2016 08:18:10 -0700 (PDT) +Received: from localhost ([2001:638:700:e000:0:1:0:61a]) + by smtp.gmail.com with ESMTPSA id w76sm13061200wmd.11.2016.06.13.08.18.08 + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Mon, 13 Jun 2016 08:18:08 -0700 (PDT) +Date: Mon, 13 Jun 2016 17:18:07 +0200 +From: Bijan Chokoufe Nejad +To: David Bremner +Cc: Tomi Ollila , notmuch@notmuchmail.org +Subject: Re: [PATCH 2/8] lib: private string map (associative array) API +Message-ID: <20160613151807.GA2109@bijan-TPX1Yoga> +References: <1465779955-5539-1-git-send-email-david@tethera.net> + <1465779955-5539-3-git-send-email-david@tethera.net> + + <871t41utqi.fsf@zancas.localnet> +MIME-Version: 1.0 +Content-Type: text/plain; charset=utf-8 +Content-Disposition: inline +Content-Transfer-Encoding: 8bit +In-Reply-To: <871t41utqi.fsf@zancas.localnet> +User-Agent: Mutt/1.5.24 (2015-08-30) +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: Mon, 13 Jun 2016 15:18:21 -0000 + +On 16-06-13, David Bremner wrote: +> Tomi Ollila writes: +> +> > On Mon, Jun 13 2016, David Bremner wrote: +> > +> >> The choice of array implementation is deliberate, for future iterator support +> >> --- +> >> lib/Makefile.local | 1 + +> >> lib/notmuch-private.h | 11 ++++ +> >> lib/string-map.c | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++ +> >> 3 files changed, 165 insertions(+) +> >> create mode 100644 lib/string-map.c +> >> +> >> diff --git a/lib/Makefile.local b/lib/Makefile.local +> >> index beb9635..9280880 100644 +> >> --- a/lib/Makefile.local +> >> +++ b/lib/Makefile.local +> >> @@ -40,6 +40,7 @@ libnotmuch_c_srcs = \ +> >> $(dir)/messages.c \ +> >> $(dir)/sha1.c \ +> >> $(dir)/built-with.c \ +> >> + $(dir)/string-map.c \ +> >> $(dir)/tags.c +> > +> > I suggest everyone to install editor which supports showing tabs & spaces +> > e.g. in different color and also visualizes trailing whitespace & trailing +> > empty lines... +> > +> +> Heh. If only such a thing existed. What about a pre-commit hook? +> The default (that I have) uses git diff --index --check --cached, but +> that seems not to be enough. +> +> d +> _______________________________________________ + +I know you guys are more in the emacs camp but just for reference/inspiration: +in VIM I have a mapping to strip trailing spaces from a file + + noremap st :%s/\s\+$/ + +This could of course go as a sed/grep command in the pre-commit hook. Concerning +the tabs, I have + + " Tabs. Note: Use :retab to clean up mixed indentation + set expandtab " Always uses spaces instead of tab characters + set tabstop=2 " Size of insterted spaces if tab is pressed + set list " Highlight tab characters in files + set listchars=tab:▸\ ,extends:#,nbsp:.,trail:⋅ + +For the pre-commit hook one could `grep -P '\t' *`. Maybe even better would be +the use of a linter but I am not sure what is most flexible for C code. + +Cheers, +Bijan