--- /dev/null
+Return-Path: <jani@nikula.org>\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 218AB6DE1B56\r
+ for <notmuch@notmuchmail.org>; Thu, 3 Sep 2015 12:40:35 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.424\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.424 tagged_above=-999 required=5 tests=[AWL=0.296,\r
+ RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01]\r
+ 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 oVAmmC1pzGg2 for <notmuch@notmuchmail.org>;\r
+ Thu, 3 Sep 2015 12:40:33 -0700 (PDT)\r
+Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com\r
+ [209.85.212.175])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 48C726DE15D4\r
+ for <notmuch@notmuchmail.org>; Thu, 3 Sep 2015 12:40:25 -0700 (PDT)\r
+Received: by wicfx3 with SMTP id fx3so1166855wic.1\r
+ for <notmuch@notmuchmail.org>; Thu, 03 Sep 2015 12:40:23 -0700 (PDT)\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:from:to:cc:subject:date:message-id:in-reply-to\r
+ :references:in-reply-to:references;\r
+ bh=VFHDC72I5GoT6PKzmB1izsWZDFNqN7WikG58dF2ZAyA=;\r
+ b=Ps+CaFqXd/i7ebRBM5SrMy4r3HhVaYRuOtHYp0YnFjYZqBtwynuf/NQ20cnylJ2dFJ\r
+ LDLNC4dCQ/Dq3DTifXnGRU6ReRza1NOHXzcZ4DPFlsjKgtJXmUT+LzUG6vrgutyRuwvN\r
+ 9+ARdBljQwKDy2ro585EOEBf4oa0qD0fpZCmrTqnFPCxg89FDIp5KtDCgIyZ0HlkCFcH\r
+ WUAAkWhBdwRq6gTmLUWY6CG1Ag5CSHHy8XMBarmR9khweimDf51wyD+I0IJ+F08D9mUe\r
+ ugmX/+Dvw1KqhtD3ToQyfaLuPgcL0GfvaIQeRsF4LKEdHdd7LLEWuyZmoqI1Q2vQ6lRF\r
+ HQRA==\r
+X-Gm-Message-State:\r
+ ALoCoQnctlhEIgLHVm97wQbCXg5hYPxqWgUS+ii01EMGL8dA2PepdsayrlJXQ2drPpi7dH0hUow8\r
+X-Received: by 10.180.87.71 with SMTP id v7mr17872859wiz.74.1441309223852;\r
+ Thu, 03 Sep 2015 12:40:23 -0700 (PDT)\r
+Received: from localhost (mobile-access-bcee4f-131.dhcp.inet.fi.\r
+ [188.238.79.131])\r
+ by smtp.gmail.com with ESMTPSA id eu2sm639314wic.8.2015.09.03.12.40.23\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Thu, 03 Sep 2015 12:40:23 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 5/9] util: move strcase_equal and strcase_hash to util\r
+Date: Thu, 3 Sep 2015 22:40:01 +0300\r
+Message-Id:\r
+ <37a90b2c8ac540599daf0e864b2a6b65b4ee35a3.1441308761.git.jani@nikula.org>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <cover.1441308761.git.jani@nikula.org>\r
+References: <cover.1441308761.git.jani@nikula.org>\r
+In-Reply-To: <cover.1441308761.git.jani@nikula.org>\r
+References: <cover.1441308761.git.jani@nikula.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://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: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 03 Sep 2015 19:40:35 -0000\r
+\r
+For future use in both cli and lib.\r
+---\r
+ lib/message-file.c | 21 ---------------------\r
+ lib/notmuch-private.h | 1 +\r
+ util/string-util.c | 21 +++++++++++++++++++++\r
+ util/string-util.h | 6 ++++++\r
+ 4 files changed, 28 insertions(+), 21 deletions(-)\r
+\r
+diff --git a/lib/message-file.c b/lib/message-file.c\r
+index 8ac96e8e06a5..ee305202fffa 100644\r
+--- a/lib/message-file.c\r
++++ b/lib/message-file.c\r
+@@ -38,27 +38,6 @@ struct _notmuch_message_file {\r
+ };\r
+ \r
+ static int\r
+-strcase_equal (const void *a, const void *b)\r
+-{\r
+- return strcasecmp (a, b) == 0;\r
+-}\r
+-\r
+-static unsigned int\r
+-strcase_hash (const void *ptr)\r
+-{\r
+- const char *s = ptr;\r
+-\r
+- /* This is the djb2 hash. */\r
+- unsigned int hash = 5381;\r
+- while (s && *s) {\r
+- hash = ((hash << 5) + hash) + tolower (*s);\r
+- s++;\r
+- }\r
+-\r
+- return hash;\r
+-}\r
+-\r
+-static int\r
+ _notmuch_message_file_destructor (notmuch_message_file_t *message)\r
+ {\r
+ if (message->headers)\r
+diff --git a/lib/notmuch-private.h b/lib/notmuch-private.h\r
+index f52b4e4776f9..5dd4770e9619 100644\r
+--- a/lib/notmuch-private.h\r
++++ b/lib/notmuch-private.h\r
+@@ -50,6 +50,7 @@ NOTMUCH_BEGIN_DECLS\r
+ \r
+ #include "xutil.h"\r
+ #include "error_util.h"\r
++#include "string-util.h"\r
+ \r
+ #pragma GCC visibility push(hidden)\r
+ \r
+diff --git a/util/string-util.c b/util/string-util.c\r
+index a90501ee3e70..76c0b9025d0f 100644\r
+--- a/util/string-util.c\r
++++ b/util/string-util.c\r
+@@ -221,3 +221,24 @@ parse_boolean_term (void *ctx, const char *str,\r
+ errno = err;\r
+ return -1;\r
+ }\r
++\r
++int\r
++strcase_equal (const void *a, const void *b)\r
++{\r
++ return strcasecmp (a, b) == 0;\r
++}\r
++\r
++unsigned int\r
++strcase_hash (const void *ptr)\r
++{\r
++ const char *s = ptr;\r
++\r
++ /* This is the djb2 hash. */\r
++ unsigned int hash = 5381;\r
++ while (s && *s) {\r
++ hash = ((hash << 5) + hash) + tolower (*s);\r
++ s++;\r
++ }\r
++\r
++ return hash;\r
++}\r
+diff --git a/util/string-util.h b/util/string-util.h\r
+index e409cb3d2ab1..80d24d1c1053 100644\r
+--- a/util/string-util.h\r
++++ b/util/string-util.h\r
+@@ -64,6 +64,12 @@ int\r
+ parse_boolean_term (void *ctx, const char *str,\r
+ char **prefix_out, char **term_out);\r
+ \r
++/* GLib GEqualFunc compatible strcasecmp wrapper */\r
++int strcase_equal (const void *a, const void *b);\r
++\r
++/* GLib GHashFunc compatible case insensitive hash function */\r
++unsigned int strcase_hash (const void *ptr);\r
++\r
+ #ifdef __cplusplus\r
+ }\r
+ #endif\r
+-- \r
+2.1.4\r
+\r