From: Junio C Hamano <gitster@pobox.com>
To: Prathamesh Chavan <pc44800@gmail.com>
Cc: git@vger.kernel.org, christian.couder@gmail.com, sbeller@google.com
Subject: Re: [PATCH v2 1/2] submodule: port submodule subcommand 'sync' from shell to C
Date: Thu, 11 Jan 2018 12:31:45 -0800 [thread overview]
Message-ID: <xmqqshbcxhla.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20180111201721.25930-2-pc44800@gmail.com> (Prathamesh Chavan's message of "Fri, 12 Jan 2018 01:47:20 +0530")
Prathamesh Chavan <pc44800@gmail.com> writes:
> + } else {
> + sub_origin_url = xstrdup(sub->url);
> + super_config_url = xstrdup(sub->url);
> + }
> + } else {
> + sub_origin_url = "";
> + super_config_url = "";
> + }
> + ...
> +cleanup:
> + if (strlen(super_config_url))
> + free(super_config_url);
> + if (strlen(sub_origin_url))
> + free(sub_origin_url);
The above is ugly and veriy likely to be wrong; imagine that
sub->url was an empty string to begin with.
Doing xstrdup("") before assigning the constant to *_url would be a
lot more sensible and maintainable solution for things like this.
next prev parent reply other threads:[~2018-01-11 20:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-09 17:57 [PATCH v1 0/2] Incremental rewrite of git-submodules Prathamesh Chavan
2018-01-09 17:57 ` [PATCH v1 1/2] submodule: port submodule subcommand 'sync' from shell to C Prathamesh Chavan
2018-01-09 20:57 ` Junio C Hamano
2018-01-09 17:57 ` [PATCH v1 2/2] submodule: port submodule subcommand 'deinit' " Prathamesh Chavan
2018-01-09 21:24 ` Junio C Hamano
2018-01-10 20:22 ` Prathamesh Chavan
2018-01-10 21:47 ` Junio C Hamano
2018-01-09 19:25 ` [PATCH v1 0/2] Incremental rewrite of git-submodules Stefan Beller
2018-01-09 20:06 ` Brandon Williams
2018-01-11 20:17 ` [PATCH v2 " Prathamesh Chavan
2018-01-11 20:17 ` [PATCH v2 1/2] submodule: port submodule subcommand 'sync' from shell to C Prathamesh Chavan
2018-01-11 20:31 ` Junio C Hamano [this message]
2018-01-11 20:17 ` [PATCH v2 2/2] submodule: port submodule subcommand 'deinit' " Prathamesh Chavan
2018-01-11 20:48 ` Junio C Hamano
2018-01-11 20:37 ` [PATCH v2 0/2] Incremental rewrite of git-submodules Junio C Hamano
2018-01-14 21:15 ` [PATCH v3 " Prathamesh Chavan
2018-01-14 21:15 ` [PATCH v3 1/2] submodule: port submodule subcommand 'sync' from shell to C Prathamesh Chavan
2018-01-14 21:15 ` [PATCH v3 2/2] submodule: port submodule subcommand 'deinit' " Prathamesh Chavan
2018-01-16 19:32 ` [PATCH v3 0/2] Incremental rewrite of git-submodules Junio C Hamano
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: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqshbcxhla.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=pc44800@gmail.com \
--cc=sbeller@google.com \
/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://80x24.org/mirrors/git.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).