git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt Kraai <kraai@ftbfs.org>
To: git@vger.kernel.org
Subject: Re: [PATCH] parse_dirstat_params(): use string_list to split comma-separated string
Date: Tue, 30 Oct 2012 18:43:51 +0000 (UTC)	[thread overview]
Message-ID: <loom.20121030T193428-242@post.gmane.org> (raw)
In-Reply-To: 1351443054-10472-1-git-send-email-mhagger@alum.mit.edu

Michael Haggerty <mhagger <at> alum.mit.edu> writes:
...
> -static int parse_dirstat_params(struct diff_options *options, const char ...
> +static int parse_dirstat_params(struct diff_options *options, const char ...
>  				struct strbuf *errmsg)
>  {
> -	const char *p = params;
> -	int p_len, ret = 0;
> +	char *params_copy = xstrdup(params_string);
> +	struct string_list params = STRING_LIST_INIT_NODUP;
> +	int ret = 0;
> +	int i;
> 
> -	while (*p) {
> -		p_len = strchrnul(p, ',') - p;
> -		if (!memcmp(p, "changes", p_len)) {
> +	if (*params_copy)

params_copy is set to the value returned by xstrdup, which cannot be NULL.
This check can be removed and if params_string can be NULL, it should be
checked before being passed to xstrdup.

  reply	other threads:[~2012-10-30 18:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-28 16:50 [PATCH] parse_dirstat_params(): use string_list to split comma-separated string Michael Haggerty
2012-10-30 18:43 ` Matt Kraai [this message]
2012-10-31 14:06   ` Jeff King
2012-10-31 15:48     ` Matt Kraai

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

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

  git send-email \
    --in-reply-to=loom.20121030T193428-242@post.gmane.org \
    --to=kraai@ftbfs.org \
    --cc=git@vger.kernel.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.
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 NNTP newsgroup(s).