git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Denton Liu <liu.denton@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH 1/2] mingw: apply array.cocci rule
Date: Wed, 04 Sep 2019 16:36:25 -0700	[thread overview]
Message-ID: <xmqq36hbskg6.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.1909042340520.5377@tvgsbejvaqbjf.bet> (Johannes Schindelin's message of "Wed, 4 Sep 2019 23:41:24 +0200 (CEST)")

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Hi Denton,
>
> On Wed, 4 Sep 2019, Denton Liu wrote:
>
>> After running Coccinelle on all sources inside compat/ that were created
>> by us[1], it was found that compat/mingw.c violated an array.cocci rule
>> in two places and, thus, a patch was generated. Apply this patch so that
>> all compat/ sources created by us follows all cocci rules.
>>
>> [1]: Do not run Coccinelle on files that are taken from some upstream
>> because in case we need to pull updates from them, we would like to have
>> diverged as little as possible in order to make merging updates simpler.
>>
>> The following sources were determined to have been taken from some
>> upstream:
>>
>> * compat/regex/
>> * compat/inet_ntop.c
>> * compat/inet_pton.c
>> * compat/nedmalloc/
>> * compat/obstack.{c,h}
>> * compat/poll/
>>
>> Signed-off-by: Denton Liu <liu.denton@gmail.com>
>> ---
>>  compat/mingw.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/compat/mingw.c b/compat/mingw.c
>> index 738f0a826a..a3b1e9e3bb 100644
>> --- a/compat/mingw.c
>> +++ b/compat/mingw.c
>> @@ -1265,7 +1265,7 @@ static wchar_t *make_environment_block(char **deltaenv)
>>  		}
>>
>>  		ALLOC_ARRAY(result, size);
>> -		memcpy(result, wenv, size * sizeof(*wenv));
>> +		COPY_ARRAY(result, wenv, size);
>>  		FreeEnvironmentStringsW(wenv);
>>  		return result;
>>  	}
>> @@ -1309,7 +1309,7 @@ static wchar_t *make_environment_block(char **deltaenv)
>>  			continue;
>>
>>  		size = wcslen(array[i]) + 1;
>> -		memcpy(p, array[i], size * sizeof(*p));
>> +		COPY_ARRAY(p, array[i], size);
>
> ACK!
>
> Thanks,
> Dscho

Yup, looks good.  Thanks both.

  reply	other threads:[~2019-09-04 23:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04 11:09 [PATCH 0/2] cleanup compat/ sources using spatch Denton Liu
2019-09-04 11:09 ` [PATCH 1/2] mingw: apply array.cocci rule Denton Liu
2019-09-04 21:41   ` Johannes Schindelin
2019-09-04 23:36     ` Junio C Hamano [this message]
2019-09-04 11:09 ` [PATCH 2/2] compat/*.[ch]: remove extern from function declarations using spatch Denton Liu
2019-09-04 21:43   ` Johannes Schindelin
2019-09-05  3:23     ` Denton Liu
2019-09-09 18:58       ` Johannes Schindelin

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=xmqq36hbskg6.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=liu.denton@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.
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).