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 9DA1E429E25
\r
6 for <notmuch@notmuchmail.org>; Sat, 29 Oct 2011 13:08:13 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id WhnSvAJplHnE for <notmuch@notmuchmail.org>;
\r
16 Sat, 29 Oct 2011 13:08:12 -0700 (PDT)
\r
17 Received: from mail-fx0-f53.google.com (mail-fx0-f53.google.com
\r
18 [209.85.161.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 76DE7431FB6
\r
21 for <notmuch@notmuchmail.org>; Sat, 29 Oct 2011 13:08:12 -0700 (PDT)
\r
22 Received: by faai28 with SMTP id i28so5095151faa.26
\r
23 for <notmuch@notmuchmail.org>; Sat, 29 Oct 2011 13:08:11 -0700 (PDT)
\r
24 Received: by 10.223.75.25 with SMTP id w25mr16506546faj.15.1319918889247;
\r
25 Sat, 29 Oct 2011 13:08:09 -0700 (PDT)
\r
26 Received: from localhost (dsl-hkibrasgw4-fe5cdc00-23.dhcp.inet.fi.
\r
28 by mx.google.com with ESMTPS id y2sm26353665fag.12.2011.10.29.13.08.05
\r
29 (version=SSLv3 cipher=OTHER); Sat, 29 Oct 2011 13:08:07 -0700 (PDT)
\r
30 From: Jani Nikula <jani@nikula.org>
\r
31 To: Daniel Schoepe <daniel@schoepe.org>, notmuch@notmuchmail.org
\r
32 Subject: Re: [RFC PATCH 2/3] cli: add support for limiting the number of
\r
34 In-Reply-To: <87mxcjk8mt.fsf@gilead.invalid>
\r
35 References: <cover.1319833617.git.jani@nikula.org>
\r
36 <f16c7983a8a639ea2ed1178a3190afb9620153e2.1319833617.git.jani@nikula.org>
\r
37 <87mxcjk8mt.fsf@gilead.invalid>
\r
38 User-Agent: Notmuch/0.9-20-gc4362a8 (http://notmuchmail.org) Emacs/23.3.1
\r
40 Date: Sat, 29 Oct 2011 23:08:04 +0300
\r
41 Message-ID: <878vo3r26z.fsf@nikula.org>
\r
43 Content-Type: text/plain; charset=us-ascii
\r
44 Cc: amdragon@mit.edu
\r
45 X-BeenThere: notmuch@notmuchmail.org
\r
46 X-Mailman-Version: 2.1.13
\r
48 List-Id: "Use and development of the notmuch mail system."
\r
49 <notmuch.notmuchmail.org>
\r
50 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
52 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
53 List-Post: <mailto:notmuch@notmuchmail.org>
\r
54 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
55 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
56 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
57 X-List-Received-Date: Sat, 29 Oct 2011 20:08:13 -0000
\r
59 On Sat, 29 Oct 2011 19:30:50 +0200, Daniel Schoepe <daniel@schoepe.org> wrote:
\r
60 > On Fri, 28 Oct 2011 23:59:30 +0300, Jani Nikula <jani@nikula.org> wrote:
\r
61 > > @@ -412,6 +413,14 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
\r
62 > > fprintf (stderr, "Invalid value for --sort: %s\n", opt);
\r
65 > > + } else if (STRNCMP_LITERAL (argv[i], "--maxitems=") == 0) {
\r
66 > > + const char *p;
\r
67 > > + opt = argv[i] + sizeof ("--maxitems=") - 1;
\r
68 > > + maxitems = strtoul(opt, &p, 10);
\r
70 > p should be of type `char *', not `const char *', as it will be
\r
71 > modified by strtoul. (Otherwise, gcc will produce a warning about this).
\r
73 strtoul() won't touch the data pointed to by p (it only modifies p), so
\r
74 in that sense it could be const, but you're right in that it really
\r
75 should be 'char *', just for a more complicated reason. Thanks for
\r
76 making me look it up: http://c-faq.com/ansi/constmismatch.html (not the
\r
77 best of explanations, perhaps, but gives an idea why the 2nd parameter
\r
78 of strtoul() can't be 'const char **').
\r