mingw: apply array.cocci rule

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> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Denton Liu committed Sep 4, 2019 at 04:09 UTC 552fc5016f16d2f2ed465278f073fa03bc1851a7
1 file changed +2 -2
compat/mingw.c
+2 -2
@@ -1265,7 +1265,7 @@ static wchar_t *make_environment_block(char **deltaenv)
1265 }
1266
1267 ALLOC_ARRAY(result, size);
1268 - memcpy(result, wenv, size * sizeof(*wenv));
1268 + COPY_ARRAY(result, wenv, size);
1269 FreeEnvironmentStringsW(wenv);
1270 return result;
1271 }
@@ -1309,7 +1309,7 @@ static wchar_t *make_environment_block(char **deltaenv)
1309 continue;
1310
1311 size = wcslen(array[i]) + 1;
1312 - memcpy(p, array[i], size * sizeof(*p));
1312 + COPY_ARRAY(p, array[i], size);
1313 p += size;
1314 }
1315 *p = L'\0';