Re: [PATCH 2/2] use COPY_ARRAY for copying arrays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
> ---
>  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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux