11#define USE_THE_REPOSITORY_VARIABLE
2- #define DISABLE_SIGN_COMPARE_WARNINGS
32
43#include "git-compat-util.h"
54#include "hex.h"
@@ -134,7 +133,8 @@ static void free_depth_in_slab(int **ptr)
134133struct commit_list * get_shallow_commits (struct object_array * heads , int depth ,
135134 int shallow_flag , int not_shallow_flag )
136135{
137- int i = 0 , cur_depth = 0 ;
136+ size_t i = 0 ;
137+ int cur_depth = 0 ;
138138 struct commit_list * result = NULL ;
139139 struct object_array stack = OBJECT_ARRAY_INIT ;
140140 struct commit * commit = NULL ;
@@ -335,16 +335,16 @@ static int write_shallow_commits_1(struct strbuf *out, int use_pack_protocol,
335335 const struct oid_array * extra ,
336336 unsigned flags )
337337{
338- struct write_shallow_data data ;
339- int i ;
340- data . out = out ;
341- data . use_pack_protocol = use_pack_protocol ;
342- data . count = 0 ;
343- data . flags = flags ;
338+ struct write_shallow_data data = {
339+ . out = out ,
340+ . use_pack_protocol = use_pack_protocol ,
341+ . flags = flags ,
342+ } ;
343+
344344 for_each_commit_graft (write_one_shallow , & data );
345345 if (!extra )
346346 return data .count ;
347- for (i = 0 ; i < extra -> nr ; i ++ ) {
347+ for (size_t i = 0 ; i < extra -> nr ; i ++ ) {
348348 strbuf_addstr (out , oid_to_hex (extra -> oid + i ));
349349 strbuf_addch (out , '\n' );
350350 data .count ++ ;
@@ -466,15 +466,14 @@ struct trace_key trace_shallow = TRACE_KEY_INIT(SHALLOW);
466466 */
467467void prepare_shallow_info (struct shallow_info * info , struct oid_array * sa )
468468{
469- int i ;
470469 trace_printf_key (& trace_shallow , "shallow: prepare_shallow_info\n" );
471470 memset (info , 0 , sizeof (* info ));
472471 info -> shallow = sa ;
473472 if (!sa )
474473 return ;
475474 ALLOC_ARRAY (info -> ours , sa -> nr );
476475 ALLOC_ARRAY (info -> theirs , sa -> nr );
477- for (i = 0 ; i < sa -> nr ; i ++ ) {
476+ for (size_t i = 0 ; i < sa -> nr ; i ++ ) {
478477 if (repo_has_object_file (the_repository , sa -> oid + i )) {
479478 struct commit_graft * graft ;
480479 graft = lookup_commit_graft (the_repository ,
@@ -507,7 +506,7 @@ void clear_shallow_info(struct shallow_info *info)
507506void remove_nonexistent_theirs_shallow (struct shallow_info * info )
508507{
509508 struct object_id * oid = info -> shallow -> oid ;
510- int i , dst ;
509+ size_t i , dst ;
511510 trace_printf_key (& trace_shallow , "shallow: remove_nonexistent_theirs_shallow\n" );
512511 for (i = dst = 0 ; i < info -> nr_theirs ; i ++ ) {
513512 if (i != dst )
@@ -560,7 +559,7 @@ static void paint_down(struct paint_info *info, const struct object_id *oid,
560559{
561560 unsigned int i , nr ;
562561 struct commit_list * head = NULL ;
563- int bitmap_nr = DIV_ROUND_UP (info -> nr_bits , 32 );
562+ size_t bitmap_nr = DIV_ROUND_UP (info -> nr_bits , 32 );
564563 size_t bitmap_size = st_mult (sizeof (uint32_t ), bitmap_nr );
565564 struct commit * c = lookup_commit_reference_gently (the_repository , oid ,
566565 1 );
@@ -660,7 +659,7 @@ void assign_shallow_commits_to_refs(struct shallow_info *info,
660659 struct object_id * oid = info -> shallow -> oid ;
661660 struct oid_array * ref = info -> ref ;
662661 unsigned int i , nr ;
663- int * shallow , nr_shallow = 0 ;
662+ size_t * shallow , nr_shallow = 0 ;
664663 struct paint_info pi ;
665664
666665 trace_printf_key (& trace_shallow , "shallow: assign_shallow_commits_to_refs\n" );
@@ -735,7 +734,7 @@ void assign_shallow_commits_to_refs(struct shallow_info *info,
735734
736735struct commit_array {
737736 struct commit * * commits ;
738- int nr , alloc ;
737+ size_t nr , alloc ;
739738};
740739
741740static int add_ref (const char * refname UNUSED ,
@@ -753,12 +752,11 @@ static int add_ref(const char *refname UNUSED,
753752 return 0 ;
754753}
755754
756- static void update_refstatus (int * ref_status , int nr , uint32_t * bitmap )
755+ static void update_refstatus (int * ref_status , size_t nr , uint32_t * bitmap )
757756{
758- unsigned int i ;
759757 if (!ref_status )
760758 return ;
761- for (i = 0 ; i < nr ; i ++ )
759+ for (size_t i = 0 ; i < nr ; i ++ )
762760 if (bitmap [i / 32 ] & (1U << (i % 32 )))
763761 ref_status [i ]++ ;
764762}
@@ -773,8 +771,8 @@ static void post_assign_shallow(struct shallow_info *info,
773771 struct object_id * oid = info -> shallow -> oid ;
774772 struct commit * c ;
775773 uint32_t * * bitmap ;
776- int dst , i , j ;
777- int bitmap_nr = DIV_ROUND_UP (info -> ref -> nr , 32 );
774+ size_t dst , i , j ;
775+ size_t bitmap_nr = DIV_ROUND_UP (info -> ref -> nr , 32 );
778776 struct commit_array ca ;
779777
780778 trace_printf_key (& trace_shallow , "shallow: post_assign_shallow\n" );
0 commit comments