Re: [PATCH 2/8] lib: private string map (associative array) API
authorBijan Chokoufe Nejad <bijan.chokoufe@gmail.com>
Mon, 13 Jun 2016 15:18:07 +0000 (17:18 +0200)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:22:05 +0000 (16:22 -0700)
7d/969fc7ab2ed6b113685fcdd8cf4679185afba8 [new file with mode: 0644]

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