Re: [PATCH v4 13/16] add indexopts to notmuch python bindings.
[notmuch-archives.git] / c8 / 0f717649c781b69e883435715f2de657b2c6f2
1 Return-Path: <m.walters@qmul.ac.uk>\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 9717C431FC9\r
6         for <notmuch@notmuchmail.org>; Sun,  2 Feb 2014 10:26:38 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 59ykr-uGb85J for <notmuch@notmuchmail.org>;\r
17         Sun,  2 Feb 2014 10:26:33 -0800 (PST)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 2AA2D431FC7\r
22         for <notmuch@notmuchmail.org>; Sun,  2 Feb 2014 10:26:33 -0800 (PST)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1WA1kV-0002cw-DA; Sun, 02 Feb 2014 18:26:31 +0000\r
27 Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
28         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71)\r
29         (envelope-from <m.walters@qmul.ac.uk>)\r
30         id 1WA1jc-0006ET-15; Sun, 02 Feb 2014 18:25:36 +0000\r
31 From: Mark Walters <markwalters1009@gmail.com>\r
32 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org\r
33 Subject: Re: [PATCH v2 3/7] util: make sanitize string available in string\r
34         util for reuse\r
35 In-Reply-To:\r
36  <6859d1e9de273e00101c10122cd8ca162cc3a542.1385825425.git.jani@nikula.org>\r
37 References: <cover.1385825425.git.jani@nikula.org>\r
38         <6859d1e9de273e00101c10122cd8ca162cc3a542.1385825425.git.jani@nikula.org>\r
39 User-Agent: Notmuch/0.15.2+484~gfb59956 (http://notmuchmail.org) Emacs/23.4.1\r
40         (x86_64-pc-linux-gnu)\r
41 Date: Sun, 02 Feb 2014 18:24:09 +0000\r
42 Message-ID: <871tzlqsom.fsf@qmul.ac.uk>\r
43 MIME-Version: 1.0\r
44 Content-Type: text/plain; charset=us-ascii\r
45 X-Sender-Host-Address: 93.97.24.31\r
46 X-QM-Geographic: According to ripencc,\r
47         this message was delivered by a machine in Britain (UK) (GB).\r
48 X-QM-SPAM-Info: Sender has good ham record.  :)\r
49 X-QM-Body-MD5: a9f5328c5f40b5e0c904f105c00820f8 (of first 20000 bytes)\r
50 X-SpamAssassin-Score: 0.0\r
51 X-SpamAssassin-SpamBar: /\r
52 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
53         determine if it is\r
54         spam. We require at least 5.0 points to mark a message as spam.\r
55         This message scored 0.0 points. Summary of the scoring: \r
56         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
57         provider *      (markwalters1009[at]gmail.com)\r
58         *  0.0 AWL AWL: From: address is in the auto white-list\r
59 X-QM-Scan-Virus: ClamAV says the message is clean\r
60 X-BeenThere: notmuch@notmuchmail.org\r
61 X-Mailman-Version: 2.1.13\r
62 Precedence: list\r
63 List-Id: "Use and development of the notmuch mail system."\r
64         <notmuch.notmuchmail.org>\r
65 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
66         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
67 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
68 List-Post: <mailto:notmuch@notmuchmail.org>\r
69 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
70 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
72 X-List-Received-Date: Sun, 02 Feb 2014 18:26:38 -0000\r
73 \r
74 \r
75 On Sat, 30 Nov 2013, Jani Nikula <jani@nikula.org> wrote:\r
76 > No functional changes.\r
77 > ---\r
78 >  notmuch-search.c   | 19 -------------------\r
79 >  util/string-util.c | 22 ++++++++++++++++++++++\r
80 >  util/string-util.h |  7 +++++++\r
81 >  3 files changed, 29 insertions(+), 19 deletions(-)\r
82 >\r
83 > diff --git a/notmuch-search.c b/notmuch-search.c\r
84 > index 11cd6ee..8b6940a 100644\r
85 > --- a/notmuch-search.c\r
86 > +++ b/notmuch-search.c\r
87 > @@ -30,25 +30,6 @@ typedef enum {\r
88 >      OUTPUT_TAGS\r
89 >  } output_t;\r
90 >  \r
91 > -static char *\r
92 > -sanitize_string (const void *ctx, const char *str)\r
93 > -{\r
94 > -    char *out, *loop;\r
95 > -\r
96 > -    if (NULL == str)\r
97 > -     return NULL;\r
98 > -\r
99 > -    loop = out = talloc_strdup (ctx, str);\r
100 > -\r
101 > -    for (; *loop; loop++) {\r
102 > -     if (*loop == '\t' || *loop == '\n')\r
103 > -         *loop = ' ';\r
104 > -     else if ((unsigned char)(*loop) < 32)\r
105 > -         *loop = '?';\r
106 > -    }\r
107 > -    return out;\r
108 > -}\r
109 > -\r
110 >  /* Return two stable query strings that identify exactly the matched\r
111 >   * and unmatched messages currently in thread.  If there are no\r
112 >   * matched or unmatched messages, the returned buffers will be\r
113 > diff --git a/util/string-util.c b/util/string-util.c\r
114 > index a5622d7..9e2f728 100644\r
115 > --- a/util/string-util.c\r
116 > +++ b/util/string-util.c\r
117 > @@ -37,6 +37,28 @@ strtok_len (char *s, const char *delim, size_t *len)\r
118 >      return *len ? s : NULL;\r
119 >  }\r
120 >  \r
121 > +char *\r
122 > +sanitize_string (const void *ctx, const char *str)\r
123 > +{\r
124 > +    char *out, *loop;\r
125 > +\r
126 > +    if (! str)\r
127 > +     return NULL;\r
128 > +\r
129 > +    out = talloc_strdup (ctx, str);\r
130 > +    if (! out)\r
131 > +     return NULL;\r
132 > +\r
133 > +    for (loop = out; *loop; loop++) {\r
134 > +     if (*loop == '\t' || *loop == '\n')\r
135 > +         *loop = ' ';\r
136 > +     else if ((unsigned char)(*loop) < 32)\r
137 > +         *loop = '?';\r
138 > +    }\r
139 > +\r
140 > +    return out;\r
141 > +}\r
142 > +\r
143 >  static int\r
144 >  is_unquoted_terminator (unsigned char c)\r
145 >  {\r
146 > diff --git a/util/string-util.h b/util/string-util.h\r
147 > index 0194607..228420d 100644\r
148 > --- a/util/string-util.h\r
149 > +++ b/util/string-util.h\r
150 > @@ -19,6 +19,13 @@\r
151 >  \r
152 >  char *strtok_len (char *s, const char *delim, size_t *len);\r
153 >  \r
154 > +/* Return a talloced string with str sanitized.\r
155 > + *\r
156 > + * Whitespace (tabs and newlines) is replaced with spaces,\r
157 > + * non-printable characters with question marks.\r
158 > + */\r
159 \r
160 A complete triviality but I would prefer "Whitespace characters (tabs\r
161 and newlines) are replaced with spaces..." just to emphasise that e.g.\r
162 multiple tabs are replaced by multiple spaces.\r
163 \r
164 Best wishes\r
165 \r
166 Mark\r
167 \r
168 \r
169 \r
170 \r
171 \r
172 \r
173 > +char *sanitize_string (const void *ctx, const char *str);\r
174 > +\r
175 >  /* Construct a boolean term query with the specified prefix (e.g.,\r
176 >   * "id") and search term, quoting term as necessary.  Specifically, if\r
177 >   * term contains any non-printable ASCII characters, non-ASCII\r
178 > -- \r
179 > 1.8.4.2\r
180 >\r
181 > _______________________________________________\r
182 > notmuch mailing list\r
183 > notmuch@notmuchmail.org\r
184 > http://notmuchmail.org/mailman/listinfo/notmuch\r