1 Return-Path: <jani@nikula.org>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id E8913431FBC
\r
6 for <notmuch@notmuchmail.org>; Sat, 30 Nov 2013 07:34:16 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"
\r
12 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
13 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id DapZPzOilK5N for <notmuch@notmuchmail.org>;
\r
17 Sat, 30 Nov 2013 07:34:11 -0800 (PST)
\r
18 Received: from mail-ea0-f174.google.com (mail-ea0-f174.google.com
\r
19 [209.85.215.174]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id 6A75E431FC7
\r
22 for <notmuch@notmuchmail.org>; Sat, 30 Nov 2013 07:34:08 -0800 (PST)
\r
23 Received: by mail-ea0-f174.google.com with SMTP id b10so7490094eae.19
\r
24 for <notmuch@notmuchmail.org>; Sat, 30 Nov 2013 07:34:07 -0800 (PST)
\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
26 d=1e100.net; s=20130820;
\r
27 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
\r
28 :references:in-reply-to:references;
\r
29 bh=awJ8sTwb5zV9KmWYH7p/0CJsHSvVgVzVXv9ctBdYGDE=;
\r
30 b=Ahw92OUn+d3zEv5VY0lE5NiCQV+8TNuowPeT+hj5bNtpL9uTmrbbClLn/y4/MtYq9T
\r
31 9+xWAbReT30bQxVByPq/ekHigTZkSNkXZa44Pc0mV7nBgsZcmULh43K35IOO7MLgH6hq
\r
32 cbW5FeG68KYBYy+w3C8G+GgnE7oYtFpzGZwliec4mh0i5h3i1I6toiNtDLtta+TrqP9A
\r
33 Mk8AA4bqRNJrpHk1wTfRCCA5Rh2t31aXpYHxeeiWWPNmtSeAKBE6Vt2YeKRvsHrRtxx8
\r
34 jYIdbrJ37Df/G4hrMHOVfMqhFLvynn90FU+7vYHWIVab8qFoCQ5+MneUmr7LVGeCDGH4
\r
37 ALoCoQmscjeV69WeNI4ij2DIFhOCSr20xdoAVe/p01QG7JbtERukMcJM1Iw02f1siHEpC+l3SBf3
\r
38 X-Received: by 10.15.67.195 with SMTP id u43mr33405654eex.14.1385825647433;
\r
39 Sat, 30 Nov 2013 07:34:07 -0800 (PST)
\r
40 Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.
\r
42 by mx.google.com with ESMTPSA id b42sm51870665eem.9.2013.11.30.07.34.06
\r
43 for <multiple recipients>
\r
44 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
45 Sat, 30 Nov 2013 07:34:06 -0800 (PST)
\r
46 From: Jani Nikula <jani@nikula.org>
\r
47 To: notmuch@notmuchmail.org
\r
48 Subject: [PATCH v2 3/7] util: make sanitize string available in string util
\r
50 Date: Sat, 30 Nov 2013 17:33:52 +0200
\r
52 <6859d1e9de273e00101c10122cd8ca162cc3a542.1385825425.git.jani@nikula.org>
\r
53 X-Mailer: git-send-email 1.8.4.2
\r
54 In-Reply-To: <cover.1385825425.git.jani@nikula.org>
\r
55 References: <cover.1385825425.git.jani@nikula.org>
\r
56 In-Reply-To: <cover.1385825425.git.jani@nikula.org>
\r
57 References: <cover.1385825425.git.jani@nikula.org>
\r
58 X-BeenThere: notmuch@notmuchmail.org
\r
59 X-Mailman-Version: 2.1.13
\r
61 List-Id: "Use and development of the notmuch mail system."
\r
62 <notmuch.notmuchmail.org>
\r
63 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
64 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
65 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
66 List-Post: <mailto:notmuch@notmuchmail.org>
\r
67 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
68 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
69 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
70 X-List-Received-Date: Sat, 30 Nov 2013 15:34:17 -0000
\r
72 No functional changes.
\r
74 notmuch-search.c | 19 -------------------
\r
75 util/string-util.c | 22 ++++++++++++++++++++++
\r
76 util/string-util.h | 7 +++++++
\r
77 3 files changed, 29 insertions(+), 19 deletions(-)
\r
79 diff --git a/notmuch-search.c b/notmuch-search.c
\r
80 index 11cd6ee..8b6940a 100644
\r
81 --- a/notmuch-search.c
\r
82 +++ b/notmuch-search.c
\r
83 @@ -30,25 +30,6 @@ typedef enum {
\r
88 -sanitize_string (const void *ctx, const char *str)
\r
95 - loop = out = talloc_strdup (ctx, str);
\r
97 - for (; *loop; loop++) {
\r
98 - if (*loop == '\t' || *loop == '\n')
\r
100 - else if ((unsigned char)(*loop) < 32)
\r
106 /* Return two stable query strings that identify exactly the matched
\r
107 * and unmatched messages currently in thread. If there are no
\r
108 * matched or unmatched messages, the returned buffers will be
\r
109 diff --git a/util/string-util.c b/util/string-util.c
\r
110 index a5622d7..9e2f728 100644
\r
111 --- a/util/string-util.c
\r
112 +++ b/util/string-util.c
\r
113 @@ -37,6 +37,28 @@ strtok_len (char *s, const char *delim, size_t *len)
\r
114 return *len ? s : NULL;
\r
118 +sanitize_string (const void *ctx, const char *str)
\r
120 + char *out, *loop;
\r
125 + out = talloc_strdup (ctx, str);
\r
129 + for (loop = out; *loop; loop++) {
\r
130 + if (*loop == '\t' || *loop == '\n')
\r
132 + else if ((unsigned char)(*loop) < 32)
\r
140 is_unquoted_terminator (unsigned char c)
\r
142 diff --git a/util/string-util.h b/util/string-util.h
\r
143 index 0194607..228420d 100644
\r
144 --- a/util/string-util.h
\r
145 +++ b/util/string-util.h
\r
148 char *strtok_len (char *s, const char *delim, size_t *len);
\r
150 +/* Return a talloced string with str sanitized.
\r
152 + * Whitespace (tabs and newlines) is replaced with spaces,
\r
153 + * non-printable characters with question marks.
\r
155 +char *sanitize_string (const void *ctx, const char *str);
\r
157 /* Construct a boolean term query with the specified prefix (e.g.,
\r
158 * "id") and search term, quoting term as necessary. Specifically, if
\r
159 * term contains any non-printable ASCII characters, non-ASCII
\r