--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 9717C431FC9\r
+ for <notmuch@notmuchmail.org>; Sun, 2 Feb 2014 10:26:38 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 59ykr-uGb85J for <notmuch@notmuchmail.org>;\r
+ Sun, 2 Feb 2014 10:26:33 -0800 (PST)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 2AA2D431FC7\r
+ for <notmuch@notmuchmail.org>; Sun, 2 Feb 2014 10:26:33 -0800 (PST)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1WA1kV-0002cw-DA; Sun, 02 Feb 2014 18:26:31 +0000\r
+Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1WA1jc-0006ET-15; Sun, 02 Feb 2014 18:25:36 +0000\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v2 3/7] util: make sanitize string available in string\r
+ util for reuse\r
+In-Reply-To:\r
+ <6859d1e9de273e00101c10122cd8ca162cc3a542.1385825425.git.jani@nikula.org>\r
+References: <cover.1385825425.git.jani@nikula.org>\r
+ <6859d1e9de273e00101c10122cd8ca162cc3a542.1385825425.git.jani@nikula.org>\r
+User-Agent: Notmuch/0.15.2+484~gfb59956 (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Sun, 02 Feb 2014 18:24:09 +0000\r
+Message-ID: <871tzlqsom.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 93.97.24.31\r
+X-QM-Geographic: According to ripencc,\r
+ this message was delivered by a machine in Britain (UK) (GB).\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: a9f5328c5f40b5e0c904f105c00820f8 (of first 20000 bytes)\r
+X-SpamAssassin-Score: 0.0\r
+X-SpamAssassin-SpamBar: /\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored 0.0 points. Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * 0.0 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\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: Sun, 02 Feb 2014 18:26:38 -0000\r
+\r
+\r
+On Sat, 30 Nov 2013, Jani Nikula <jani@nikula.org> wrote:\r
+> No functional changes.\r
+> ---\r
+> notmuch-search.c | 19 -------------------\r
+> util/string-util.c | 22 ++++++++++++++++++++++\r
+> util/string-util.h | 7 +++++++\r
+> 3 files changed, 29 insertions(+), 19 deletions(-)\r
+>\r
+> diff --git a/notmuch-search.c b/notmuch-search.c\r
+> index 11cd6ee..8b6940a 100644\r
+> --- a/notmuch-search.c\r
+> +++ b/notmuch-search.c\r
+> @@ -30,25 +30,6 @@ typedef enum {\r
+> OUTPUT_TAGS\r
+> } output_t;\r
+> \r
+> -static char *\r
+> -sanitize_string (const void *ctx, const char *str)\r
+> -{\r
+> - char *out, *loop;\r
+> -\r
+> - if (NULL == str)\r
+> - return NULL;\r
+> -\r
+> - loop = out = talloc_strdup (ctx, str);\r
+> -\r
+> - for (; *loop; loop++) {\r
+> - if (*loop == '\t' || *loop == '\n')\r
+> - *loop = ' ';\r
+> - else if ((unsigned char)(*loop) < 32)\r
+> - *loop = '?';\r
+> - }\r
+> - return out;\r
+> -}\r
+> -\r
+> /* Return two stable query strings that identify exactly the matched\r
+> * and unmatched messages currently in thread. If there are no\r
+> * matched or unmatched messages, the returned buffers will be\r
+> diff --git a/util/string-util.c b/util/string-util.c\r
+> index a5622d7..9e2f728 100644\r
+> --- a/util/string-util.c\r
+> +++ b/util/string-util.c\r
+> @@ -37,6 +37,28 @@ strtok_len (char *s, const char *delim, size_t *len)\r
+> return *len ? s : NULL;\r
+> }\r
+> \r
+> +char *\r
+> +sanitize_string (const void *ctx, const char *str)\r
+> +{\r
+> + char *out, *loop;\r
+> +\r
+> + if (! str)\r
+> + return NULL;\r
+> +\r
+> + out = talloc_strdup (ctx, str);\r
+> + if (! out)\r
+> + return NULL;\r
+> +\r
+> + for (loop = out; *loop; loop++) {\r
+> + if (*loop == '\t' || *loop == '\n')\r
+> + *loop = ' ';\r
+> + else if ((unsigned char)(*loop) < 32)\r
+> + *loop = '?';\r
+> + }\r
+> +\r
+> + return out;\r
+> +}\r
+> +\r
+> static int\r
+> is_unquoted_terminator (unsigned char c)\r
+> {\r
+> diff --git a/util/string-util.h b/util/string-util.h\r
+> index 0194607..228420d 100644\r
+> --- a/util/string-util.h\r
+> +++ b/util/string-util.h\r
+> @@ -19,6 +19,13 @@\r
+> \r
+> char *strtok_len (char *s, const char *delim, size_t *len);\r
+> \r
+> +/* Return a talloced string with str sanitized.\r
+> + *\r
+> + * Whitespace (tabs and newlines) is replaced with spaces,\r
+> + * non-printable characters with question marks.\r
+> + */\r
+\r
+A complete triviality but I would prefer "Whitespace characters (tabs\r
+and newlines) are replaced with spaces..." just to emphasise that e.g.\r
+multiple tabs are replaced by multiple spaces.\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+\r
+\r
+\r
+\r
+> +char *sanitize_string (const void *ctx, const char *str);\r
+> +\r
+> /* Construct a boolean term query with the specified prefix (e.g.,\r
+> * "id") and search term, quoting term as necessary. Specifically, if\r
+> * term contains any non-printable ASCII characters, non-ASCII\r
+> -- \r
+> 1.8.4.2\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r