diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2017-05-22 17:17:37 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-05-23 08:29:53 +0300 |
commit | 43a2dfde76a4a47ffa31be11fd5cd7fe0b57bb84 (patch) | |
tree | c9d4664b2c42adcee4316a92548b40e03cb23baa /refs | |
parent | c7599718167de62c437490e9ea300eeb9284a572 (diff) |
refs: use `size_t` indexes when iterating over ref transaction updates
Eliminate any chance of integer overflow on platforms where the two
types have different sizes.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs')
-rw-r--r-- | refs/files-backend.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c index fa5d2b6f08..b2559b5585 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2850,7 +2850,8 @@ static int files_transaction_commit(struct ref_store *ref_store, struct files_ref_store *refs = files_downcast(ref_store, REF_STORE_WRITE, "ref_transaction_commit"); - int ret = 0, i; + size_t i; + int ret = 0; struct string_list refs_to_delete = STRING_LIST_INIT_NODUP; struct string_list_item *ref_to_delete; struct string_list affected_refnames = STRING_LIST_INIT_NODUP; @@ -3057,7 +3058,8 @@ static int files_initial_transaction_commit(struct ref_store *ref_store, struct files_ref_store *refs = files_downcast(ref_store, REF_STORE_WRITE, "initial_ref_transaction_commit"); - int ret = 0, i; + size_t i; + int ret = 0; struct string_list affected_refnames = STRING_LIST_INIT_NODUP; assert(err); |