diff options
| author | Junio C Hamano <gitster@pobox.com> | 2017-08-11 13:26:57 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2017-08-11 13:26:57 -0700 |
| commit | 32f90258bd510d84dfe8970211ec1427e9e327dc (patch) | |
| tree | 6727e0574f5c648aec927e43545617b0c5fca32e /string-list.c | |
| parent | c2bfd0f9cba5e94c08dcc1033d39d7bef29be08e (diff) | |
| parent | 168e63554cbd965fee4d0092e02f8170eba7481f (diff) | |
| download | git-32f90258bd510d84dfe8970211ec1427e9e327dc.tar.gz | |
Merge branch 'rs/move-array'
Code clean-up.
* rs/move-array:
ls-files: don't try to prune an empty index
apply: use COPY_ARRAY and MOVE_ARRAY in update_image()
use MOVE_ARRAY
add MOVE_ARRAY
Diffstat (limited to 'string-list.c')
| -rw-r--r-- | string-list.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/string-list.c b/string-list.c index c650500c6e..806b4c8723 100644 --- a/string-list.c +++ b/string-list.c @@ -43,9 +43,8 @@ static int add_entry(int insert_at, struct string_list *list, const char *string ALLOC_GROW(list->items, list->nr+1, list->alloc); if (index < list->nr) - memmove(list->items + index + 1, list->items + index, - (list->nr - index) - * sizeof(struct string_list_item)); + MOVE_ARRAY(list->items + index + 1, list->items + index, + list->nr - index); list->items[index].string = list->strdup_strings ? xstrdup(string) : (char *)string; list->items[index].util = NULL; @@ -77,8 +76,7 @@ void string_list_remove(struct string_list *list, const char *string, free(list->items[i].util); list->nr--; - memmove(list->items + i, list->items + i + 1, - (list->nr - i) * sizeof(struct string_list_item)); + MOVE_ARRAY(list->items + i, list->items + i + 1, list->nr - i); } } |
