use DUP_ARRAY

Add a semantic patch for replace ALLOC_ARRAY+COPY_ARRAY with DUP_ARRAY
to reduce code duplication and apply its results.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe
2023-01-01 22:16:48 +01:00
committed by Junio C Hamano
parent d2ec87a684
commit 6e57841096
8 changed files with 15 additions and 16 deletions

View File

@ -1396,8 +1396,7 @@ static wchar_t *make_environment_block(char **deltaenv)
p += s;
}
ALLOC_ARRAY(result, size);
COPY_ARRAY(result, wenv, size);
DUP_ARRAY(result, wenv, size);
FreeEnvironmentStringsW(wenv);
return result;
}