Skip to content

Commit 552fc50

Browse files
Denton-Lgitster
authored andcommitted
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 <[email protected]> Acked-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5fa0f52 commit 552fc50

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compat/mingw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,7 +1265,7 @@ static wchar_t *make_environment_block(char **deltaenv)
12651265
}
12661266

12671267
ALLOC_ARRAY(result, size);
1268-
memcpy(result, wenv, size * sizeof(*wenv));
1268+
COPY_ARRAY(result, wenv, size);
12691269
FreeEnvironmentStringsW(wenv);
12701270
return result;
12711271
}
@@ -1309,7 +1309,7 @@ static wchar_t *make_environment_block(char **deltaenv)
13091309
continue;
13101310

13111311
size = wcslen(array[i]) + 1;
1312-
memcpy(p, array[i], size * sizeof(*p));
1312+
COPY_ARRAY(p, array[i], size);
13131313
p += size;
13141314
}
13151315
*p = L'\0';

0 commit comments

Comments
 (0)