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>
This commit is contained in:
committed by
Junio C Hamano
parent
c759971816
commit
43a2dfde76
2
refs.c
2
refs.c
@@ -848,7 +848,7 @@ struct ref_transaction *ref_transaction_begin(struct strbuf *err)
|
|||||||
|
|
||||||
void ref_transaction_free(struct ref_transaction *transaction)
|
void ref_transaction_free(struct ref_transaction *transaction)
|
||||||
{
|
{
|
||||||
int i;
|
size_t i;
|
||||||
|
|
||||||
if (!transaction)
|
if (!transaction)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -2850,7 +2850,8 @@ static int files_transaction_commit(struct ref_store *ref_store,
|
|||||||
struct files_ref_store *refs =
|
struct files_ref_store *refs =
|
||||||
files_downcast(ref_store, REF_STORE_WRITE,
|
files_downcast(ref_store, REF_STORE_WRITE,
|
||||||
"ref_transaction_commit");
|
"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 refs_to_delete = STRING_LIST_INIT_NODUP;
|
||||||
struct string_list_item *ref_to_delete;
|
struct string_list_item *ref_to_delete;
|
||||||
struct string_list affected_refnames = STRING_LIST_INIT_NODUP;
|
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 =
|
struct files_ref_store *refs =
|
||||||
files_downcast(ref_store, REF_STORE_WRITE,
|
files_downcast(ref_store, REF_STORE_WRITE,
|
||||||
"initial_ref_transaction_commit");
|
"initial_ref_transaction_commit");
|
||||||
int ret = 0, i;
|
size_t i;
|
||||||
|
int ret = 0;
|
||||||
struct string_list affected_refnames = STRING_LIST_INIT_NODUP;
|
struct string_list affected_refnames = STRING_LIST_INIT_NODUP;
|
||||||
|
|
||||||
assert(err);
|
assert(err);
|
||||||
|
|||||||
Reference in New Issue
Block a user