pack-objects: use unsigned int for counter and offset values
This is done in some of the new pack layout code introduced in commit 1b4bb16b9ec331c. 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 <dpmcgee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Dan McGee committed
Oct 18, 2011 at 00:21 UTC
92bef1a14a6755ce1407a0e180cdc9e14a5c56b9
1 file changed
+6
-6
builtin/pack-objects.c
+6
-6
@@ -455,7 +455,7 @@ static int mark_tagged(const char *path, const unsigned char *sha1, int flag,
455
}
456
457
static inline void add_to_write_order(struct object_entry **wo,
458
- int *endp,
458
+ unsigned int *endp,
459
struct object_entry *e)
460
{
461
if (e->filled)
@@ -465,7 +465,7 @@ static inline void add_to_write_order(struct object_entry **wo,
465
}
466
467
static void add_descendants_to_write_order(struct object_entry **wo,
468
- int *endp,
468
+ unsigned int *endp,
469
struct object_entry *e)
470
{
471
struct object_entry *child;
@@ -477,7 +477,7 @@ static void add_descendants_to_write_order(struct object_entry **wo,
477
}
478
479
static void add_family_to_write_order(struct object_entry **wo,
480
- int *endp,
480
+ unsigned int *endp,
481
struct object_entry *e)
482
{
483
struct object_entry *root;
@@ -490,7 +490,7 @@ static void add_family_to_write_order(struct object_entry **wo,
490
491
static struct object_entry **compute_write_order(void)
492
{
493
- int i, wo_end;
493
+ unsigned int i, wo_end;
494
495
struct object_entry **wo = xmalloc(nr_objects * sizeof(*wo));
496
@@ -506,8 +506,8 @@ static struct object_entry **compute_write_order(void)
506
* Make sure delta_sibling is sorted in the original
507
* recency order.
508
*/
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];
511
if (!e->delta)
512
continue;
513
/* Mark me as the first child */