Re: [RFC PATCH 2/3] cli: add support for limiting the number of search results

Subject: Re: [RFC PATCH 2/3] cli: add support for limiting the number of search results

Date: Sat, 29 Oct 2011 19:30:50 +0200

To: Jani Nikula, notmuch@notmuchmail.org

Cc: amdragon@mit.edu

From: Daniel Schoepe


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).

Cheers,
Daniel
part-000.sig (application/pgp-signature)

Thread: