summaryrefslogtreecommitdiff
path: root/compat/mingw.c
diff options
context:
space:
mode:
authorDenton Liu <liu.denton@gmail.com>2019-09-04 11:09:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-09-05 18:05:03 (GMT)
commit552fc5016f16d2f2ed465278f073fa03bc1851a7 (patch)
treef882c863771eb76d363c5a6d4281db104f112d41 /compat/mingw.c
parent5fa0f5238b0cd46cfe7f6fa76c3f526ea98148d9 (diff)
downloadgit-552fc5016f16d2f2ed465278f073fa03bc1851a7.zip
git-552fc5016f16d2f2ed465278f073fa03bc1851a7.tar.gz
git-552fc5016f16d2f2ed465278f073fa03bc1851a7.tar.bz2
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>
Diffstat (limited to 'compat/mingw.c')
-rw-r--r--compat/mingw.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 738f0a8..a3b1e9e 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);
p += size;
}
*p = L'\0';