Skip to content

Commit 92bef1a

Browse files
toofishesgitster
authored andcommitted
pack-objects: use unsigned int for counter and offset values
This is done in some of the new pack layout code introduced in commit 1b4bb16. This more closely matches the nr_objects global that is unsigned that these variables are based off of and bounded by. Signed-off-by: Dan McGee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent be12681 commit 92bef1a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

builtin/pack-objects.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ static int mark_tagged(const char *path, const unsigned char *sha1, int flag,
455455
}
456456

457457
static inline void add_to_write_order(struct object_entry **wo,
458-
int *endp,
458+
unsigned int *endp,
459459
struct object_entry *e)
460460
{
461461
if (e->filled)
@@ -465,7 +465,7 @@ static inline void add_to_write_order(struct object_entry **wo,
465465
}
466466

467467
static void add_descendants_to_write_order(struct object_entry **wo,
468-
int *endp,
468+
unsigned int *endp,
469469
struct object_entry *e)
470470
{
471471
struct object_entry *child;
@@ -477,7 +477,7 @@ static void add_descendants_to_write_order(struct object_entry **wo,
477477
}
478478

479479
static void add_family_to_write_order(struct object_entry **wo,
480-
int *endp,
480+
unsigned int *endp,
481481
struct object_entry *e)
482482
{
483483
struct object_entry *root;
@@ -490,7 +490,7 @@ static void add_family_to_write_order(struct object_entry **wo,
490490

491491
static struct object_entry **compute_write_order(void)
492492
{
493-
int i, wo_end;
493+
unsigned int i, wo_end;
494494

495495
struct object_entry **wo = xmalloc(nr_objects * sizeof(*wo));
496496

@@ -506,8 +506,8 @@ static struct object_entry **compute_write_order(void)
506506
* Make sure delta_sibling is sorted in the original
507507
* recency order.
508508
*/
509-
for (i = nr_objects - 1; 0 <= i; i--) {
510-
struct object_entry *e = &objects[i];
509+
for (i = nr_objects; i > 0;) {
510+
struct object_entry *e = &objects[--i];
511511
if (!e->delta)
512512
continue;
513513
/* Mark me as the first child */

0 commit comments

Comments
 (0)