diff options
| author | Junio C Hamano <gitster@pobox.com> | 2022-07-09 18:33:54 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-07-09 18:38:57 -0700 |
| commit | eee227ad8e759c0e7f625de3ee4458f85e4c9539 (patch) | |
| tree | 6b4f80af51bab63ed139ff4de3806423fa46252c /submodule.c | |
| parent | dc8c8deaa6b5847733bd7df011a4c7b7d1a64e0a (diff) | |
| download | git-eee227ad8e759c0e7f625de3ee4458f85e4c9539.tar.gz | |
builtin/mv.c: use the MOVE_ARRAY() macro instead of memmove()
The variables 'source', 'destination', and 'submodule_gitfile' are
all of type "const char **", and an element of such an array is of
"type const char *", but these memmove() calls were written as if
these variables are of type "char **".
Once these memmove() calls are fixed to use the correct type to
compute the number of bytes to be moved, e.g.
- memmove(source + i, source + i + 1, n * sizeof(char *));
+ memmove(source + i, source + i + 1, n * sizeof(const char *));
existing contrib/coccinelle/array.cocci rules can recognize them as
candidates for turning into MOVE_ARRAY().
While at it, use CALLOC_ARRAY() instead of xcalloc() to allocate the
modes[] array that is involved in the change.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'submodule.c')
0 files changed, 0 insertions, 0 deletions
