From: Derrick Stolee <stolee@gmail.com>
To: Alex Henrie <alexhenrie24@gmail.com>,
git@vger.kernel.org, dstolee@microsoft.com, gitster@pobox.com,
davvid@gmail.com
Subject: Re: [PATCH 3/3] wrapper: use a loop instead of repetitive statements
Date: Thu, 26 Sep 2019 09:13:08 -0400 [thread overview]
Message-ID: <03e509db-942e-4538-4729-4e345df82a7e@gmail.com> (raw)
In-Reply-To: <20190925020158.751492-4-alexhenrie24@gmail.com>
On 9/24/2019 10:01 PM, Alex Henrie wrote:
> Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
> ---
> wrapper.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/wrapper.c b/wrapper.c
> index c55d7722d7..c23ac6adcd 100644
> --- a/wrapper.c
> +++ b/wrapper.c
> @@ -469,13 +469,12 @@ int git_mkstemps_mode(char *pattern, int suffix_len, int mode)
> filename_template = &pattern[len - 6 - suffix_len];
> for (count = 0; count < TMP_MAX; ++count) {
> uint64_t v = value;
> + int i;
> /* Fill in the random bits. */
> - filename_template[0] = letters[v % num_letters]; v /= num_letters;
> - filename_template[1] = letters[v % num_letters]; v /= num_letters;
> - filename_template[2] = letters[v % num_letters]; v /= num_letters;
> - filename_template[3] = letters[v % num_letters]; v /= num_letters;
> - filename_template[4] = letters[v % num_letters]; v /= num_letters;
> - filename_template[5] = letters[v % num_letters]; v /= num_letters;
> + for (i = 0; i < 6; i++) {
> + filename_template[i] = letters[v % num_letters];
> + v /= num_letters;
> + }
>
> fd = open(pattern, O_CREAT | O_EXCL | O_RDWR, mode);
> if (fd >= 0)
>
This change is clear.
Thanks,
-Stolee
next prev parent reply other threads:[~2019-09-26 13:13 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-25 2:01 [PATCH 0/3] scan-build fixes Alex Henrie
2019-09-25 2:01 ` [PATCH 1/3] commit-graph: remove a duplicate assignment Alex Henrie
2019-09-26 13:02 ` Derrick Stolee
2019-09-26 18:05 ` Alex Henrie
2019-09-25 2:01 ` [PATCH 2/3] diffcore-break: use a goto instead of a redundant if statement Alex Henrie
2019-09-26 13:12 ` Derrick Stolee
2019-09-25 2:01 ` [PATCH 3/3] wrapper: use a loop instead of repetitive statements Alex Henrie
2019-09-26 13:13 ` Derrick Stolee [this message]
2019-09-26 20:14 ` Johannes Schindelin
2019-09-27 2:50 ` Jeff King
2019-09-29 0:51 ` Alex Henrie
2019-09-27 2:45 ` Jeff King
2019-09-27 11:48 ` Derrick Stolee
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=03e509db-942e-4538-4729-4e345df82a7e@gmail.com \
--to=stolee@gmail.com \
--cc=alexhenrie24@gmail.com \
--cc=davvid@gmail.com \
--cc=dstolee@microsoft.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).