From: Derrick Stolee <stolee@gmail.com>
To: "René Scharfe" <l.s.r@web.de>, "Git Mailing List" <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 2/2] use COPY_ARRAY for copying arrays
Date: Sun, 16 Jun 2019 21:14:06 -0400 [thread overview]
Message-ID: <d51041e1-c931-146f-51e7-8a51655dcaa0@gmail.com> (raw)
In-Reply-To: <e09e49a6-8f6d-1f26-005a-bec5f99414dd@web.de>
On 6/15/2019 2:36 PM, René Scharfe wrote:
> Convert calls of memcpy(3) to use COPY_ARRAY, which shortens and
> simplifies the code a bit.
These changes do look simpler. Thanks!
> Patch generated by Coccinelle and contrib/coccinelle/array.cocci.
And this auto-generation is particularly useful!
>
> Signed-off-by: Rene Scharfe <l.s.r@web.de>
> ---
> fast-import.c | 2 +-
> kwset.c | 2 +-
> packfile.c | 6 +++---
> pretty.c | 4 ++--
> 4 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/kwset.c b/kwset.c
> index 4fb6455aca..090ffcafa2 100644
> --- a/kwset.c
> +++ b/kwset.c
> @@ -475,7 +475,7 @@ kwsprep (kwset_t kws)
> for (i = 0; i < NCHAR; ++i)
> kwset->next[i] = next[U(trans[i])];
> else
> - memcpy(kwset->next, next, NCHAR * sizeof(struct trie *));
> + COPY_ARRAY(kwset->next, next, NCHAR);
I was unfamiliar with kwset.c, so I took a look and noticed that
it was adapted from GNU grep, so this change takes us even farther
from the original source (and closer to Git source conventions).
I think this is the right thing to do, but thought I'd point it
out in case anyone thought differently.
Both patches LGTM.
Thanks,
-Stolee
prev parent reply other threads:[~2019-06-17 1:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-15 18:32 [PATCH 1/2] coccinelle: use COPY_ARRAY for copying arrays René Scharfe
2019-06-15 18:36 ` [PATCH 2/2] " René Scharfe
2019-06-17 1:14 ` Derrick Stolee [this message]
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=d51041e1-c931-146f-51e7-8a51655dcaa0@gmail.com \
--to=stolee@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=l.s.r@web.de \
/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).