From: Michael Haggerty <mhagger@alum.mit.edu>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH 2/5] safe_create_leading_directories(): reduce scope of local variable
Date: Wed, 01 Jan 2014 13:39:55 +0100 [thread overview]
Message-ID: <52C40C9B.2040001@alum.mit.edu> (raw)
In-Reply-To: <20131226215559.GX20443@google.com>
On 12/26/2013 10:55 PM, Jonathan Nieder wrote:
> Michael Haggerty wrote:
>
>> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
>> ---
>> sha1_file.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/sha1_file.c b/sha1_file.c
>> index c9245a6..cc9957e 100644
>> --- a/sha1_file.c
>> +++ b/sha1_file.c
>> @@ -108,9 +108,10 @@ int mkdir_in_gitdir(const char *path)
>> int safe_create_leading_directories(char *path)
>> {
>> char *pos = path + offset_1st_component(path);
>> - struct stat st;
>>
>> while (pos) {
>> + struct stat st;
>
> Is this to make it easier to reason about whether 'st' has been
> properly initialized at any given moment, or is there a more subtle
> reason?
No, just the boring reason, the one that makes me reduce the scope of
variables whenever possible. I'll buff up the log message.
Michael
--
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
next prev parent reply other threads:[~2014-01-01 12:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-22 7:14 [PATCH 0/5] Fix two mkdir/rmdir races Michael Haggerty
2013-12-22 7:14 ` [PATCH 1/5] safe_create_leading_directories(): modernize format of "if" chaining Michael Haggerty
2013-12-26 21:52 ` Jonathan Nieder
2013-12-22 7:14 ` [PATCH 2/5] safe_create_leading_directories(): reduce scope of local variable Michael Haggerty
2013-12-26 21:55 ` Jonathan Nieder
2014-01-01 12:39 ` Michael Haggerty [this message]
2013-12-22 7:14 ` [PATCH 3/5] safe_create_leading_directories(): add "slash" pointer Michael Haggerty
2013-12-26 22:34 ` Jonathan Nieder
2014-01-01 21:10 ` Michael Haggerty
2013-12-22 7:14 ` [PATCH 4/5] safe_create_leading_directories(): fix a mkdir/rmdir race Michael Haggerty
2013-12-22 22:42 ` Ramsay Jones
2013-12-26 23:02 ` Jonathan Nieder
2014-01-02 0:53 ` Michael Haggerty
2013-12-22 7:14 ` [PATCH 5/5] rename_ref(): fix a mkdir()/rmdir() race Michael Haggerty
2013-12-26 23:20 ` Jonathan Nieder
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=52C40C9B.2040001@alum.mit.edu \
--to=mhagger@alum.mit.edu \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.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.
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).