unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jani Nikula <jani@nikula.org>
To: Daniel Schoepe <daniel@schoepe.org>, notmuch@notmuchmail.org
Cc: amdragon@mit.edu
Subject: Re: [RFC PATCH 2/3] cli: add support for limiting the number of search results
Date: Sat, 29 Oct 2011 23:08:04 +0300	[thread overview]
Message-ID: <878vo3r26z.fsf@nikula.org> (raw)
In-Reply-To: <87mxcjk8mt.fsf@gilead.invalid>

On Sat, 29 Oct 2011 19:30:50 +0200, Daniel Schoepe <daniel@schoepe.org> wrote:
> On Fri, 28 Oct 2011 23:59:30 +0300, Jani Nikula <jani@nikula.org> wrote:
> > @@ -412,6 +413,14 @@ notmuch_search_command (void *ctx, int argc, char *argv[])
> >  		fprintf (stderr, "Invalid value for --sort: %s\n", opt);
> >  		return 1;
> >  	    }
> > +	} else if (STRNCMP_LITERAL (argv[i], "--maxitems=") == 0) {
> > +	    const char *p;
> > +	    opt = argv[i] + sizeof ("--maxitems=") - 1;
> > +	    maxitems = strtoul(opt, &p, 10);
> 
> p should be of type `char *', not `const char *', as it will be
> modified by strtoul. (Otherwise, gcc will produce a warning about this).

strtoul() won't touch the data pointed to by p (it only modifies p), so
in that sense it could be const, but you're right in that it really
should be 'char *', just for a more complicated reason. Thanks for
making me look it up: http://c-faq.com/ansi/constmismatch.html (not the
best of explanations, perhaps, but gives an idea why the 2nd parameter
of strtoul() can't be 'const char **').

BR,
Jani.

  reply	other threads:[~2011-10-29 20:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-28 20:59 [RFC PATCH 0/3] lib/cli/emacs: limit number of messages in search results Jani Nikula
2011-10-28 20:59 ` [RFC PATCH 1/3] lib: add support for limiting the number of " Jani Nikula
2011-10-28 20:59 ` [RFC PATCH 2/3] cli: " Jani Nikula
2011-10-29 17:30   ` Daniel Schoepe
2011-10-29 20:08     ` Jani Nikula [this message]
2011-10-29 20:15       ` Daniel Schoepe
2011-10-28 20:59 ` [RFC PATCH 3/3] emacs: support limiting the number of messages shown in " Jani Nikula
2011-10-29 17:25   ` Daniel Schoepe
2011-10-29 20:28     ` Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878vo3r26z.fsf@nikula.org \
    --to=jani@nikula.org \
    --cc=amdragon@mit.edu \
    --cc=daniel@schoepe.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).