We have two types in this code: in-pack and canonical. "in_pack_type"
makes it clearer than plain "type".

Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com>
---
 builtin/index-pack.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 48fa472..797e571 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -19,7 +19,7 @@ struct object_entry {
        struct pack_idx_entry idx;
        unsigned long size;
        unsigned char hdr_size;
-       signed char type;
+       signed char in_pack_type;
        signed char real_type;
 };
 
@@ -493,7 +493,7 @@ static void *unpack_raw_entry(struct object_entry *obj,
        p = fill(1);
        c = *p;
        use(1);
-       obj->type = (c >> 4) & 7;
+       obj->in_pack_type = (c >> 4) & 7;
        size = (c & 15);
        shift = 4;
        while (c & 0x80) {
@@ -505,7 +505,7 @@ static void *unpack_raw_entry(struct object_entry *obj,
        }
        obj->size = size;
 
-       switch (obj->type) {
+       switch (obj->in_pack_type) {
        case OBJ_REF_DELTA:
                hashcpy(ref_sha1, fill(20));
                use(20);
@@ -534,11 +534,11 @@ static void *unpack_raw_entry(struct object_entry *obj,
        case OBJ_TAG:
                break;
        default:
-               bad_object(obj->idx.offset, _("unknown object type %d"), 
obj->type);
+               bad_object(obj->idx.offset, _("unknown object type %d"), 
obj->in_pack_type);
        }
        obj->hdr_size = consumed_bytes - obj->idx.offset;
 
-       data = unpack_entry_data(obj->idx.offset, obj->size, obj->type, sha1);
+       data = unpack_entry_data(obj->idx.offset, obj->size, obj->in_pack_type, 
sha1);
        obj->idx.crc32 = input_crc32;
        return data;
 }
@@ -631,7 +631,7 @@ static int find_ofs_delta(const off_t offset, enum 
object_type type)
                int cmp;
 
                cmp = compare_ofs_delta_bases(offset, delta->offset,
-                                             type, 
objects[delta->obj_no].type);
+                                             type, 
objects[delta->obj_no].in_pack_type);
                if (!cmp)
                        return next;
                if (cmp < 0) {
@@ -685,7 +685,7 @@ static int find_ref_delta(const unsigned char *sha1, enum 
object_type type)
                int cmp;
 
                cmp = compare_ref_delta_bases(sha1, delta->sha1,
-                                             type, 
objects[delta->obj_no].type);
+                                             type, 
objects[delta->obj_no].in_pack_type);
                if (!cmp)
                        return next;
                if (cmp < 0) {
@@ -759,7 +759,7 @@ static int check_collison(struct object_entry *entry)
        enum object_type type;
        unsigned long size;
 
-       if (entry->size <= big_file_threshold || entry->type != OBJ_BLOB)
+       if (entry->size <= big_file_threshold || entry->in_pack_type != 
OBJ_BLOB)
                return -1;
 
        memset(&data, 0, sizeof(data));
@@ -767,7 +767,7 @@ static int check_collison(struct object_entry *entry)
        data.st = open_istream(entry->idx.sha1, &type, &size, NULL);
        if (!data.st)
                return -1;
-       if (size != entry->size || type != entry->type)
+       if (size != entry->size || type != entry->in_pack_type)
                die(_("SHA1 COLLISION FOUND WITH %s !"),
                    sha1_to_hex(entry->idx.sha1));
        unpack_data(entry, compare_objects, &data);
@@ -891,7 +891,7 @@ static void *get_base_data(struct base_data *c)
                struct base_data **delta = NULL;
                int delta_nr = 0, delta_alloc = 0;
 
-               while (is_delta_type(c->obj->type) && !c->data) {
+               while (is_delta_type(c->obj->in_pack_type) && !c->data) {
                        ALLOC_GROW(delta, delta_nr + 1, delta_alloc);
                        delta[delta_nr++] = c;
                        c = c->base;
@@ -1085,7 +1085,7 @@ static void *threaded_second_pass(void *data)
                counter_unlock();
                work_lock();
                while (nr_dispatched < nr_objects &&
-                      is_delta_type(objects[nr_dispatched].type))
+                      is_delta_type(objects[nr_dispatched].in_pack_type))
                        nr_dispatched++;
                if (nr_dispatched >= nr_objects) {
                        work_unlock();
@@ -1121,12 +1121,12 @@ static void parse_pack_objects(unsigned char *sha1)
                struct object_entry *obj = &objects[i];
                void *data = unpack_raw_entry(obj, &ofs_delta->offset,
                                              ref_delta_sha1, obj->idx.sha1);
-               obj->real_type = obj->type;
-               if (obj->type == OBJ_OFS_DELTA) {
+               obj->real_type = obj->in_pack_type;
+               if (obj->in_pack_type == OBJ_OFS_DELTA) {
                        nr_ofs_deltas++;
                        ofs_delta->obj_no = i;
                        ofs_delta++;
-               } else if (obj->type == OBJ_REF_DELTA) {
+               } else if (obj->in_pack_type == OBJ_REF_DELTA) {
                        ALLOC_GROW(ref_deltas, nr_ref_deltas + 1, 
ref_deltas_alloc);
                        hashcpy(ref_deltas[nr_ref_deltas].sha1, ref_delta_sha1);
                        ref_deltas[nr_ref_deltas].obj_no = i;
@@ -1136,7 +1136,7 @@ static void parse_pack_objects(unsigned char *sha1)
                        obj->real_type = OBJ_BAD;
                        nr_delays++;
                } else
-                       sha1_object(data, NULL, obj->size, obj->type, 
obj->idx.sha1);
+                       sha1_object(data, NULL, obj->size, obj->in_pack_type, 
obj->idx.sha1);
                free(data);
                display_progress(progress, i+1);
        }
@@ -1161,8 +1161,8 @@ static void parse_pack_objects(unsigned char *sha1)
                struct object_entry *obj = &objects[i];
                if (obj->real_type != OBJ_BAD)
                        continue;
-               obj->real_type = obj->type;
-               sha1_object(NULL, obj, obj->size, obj->type, obj->idx.sha1);
+               obj->real_type = obj->in_pack_type;
+               sha1_object(NULL, obj, obj->size, obj->in_pack_type, 
obj->idx.sha1);
                nr_delays--;
        }
        if (nr_delays)
@@ -1215,7 +1215,7 @@ static void resolve_deltas(void)
        for (i = 0; i < nr_objects; i++) {
                struct object_entry *obj = &objects[i];
 
-               if (is_delta_type(obj->type))
+               if (is_delta_type(obj->in_pack_type))
                        continue;
                resolve_base(obj);
                display_progress(progress, nr_resolved_deltas);
@@ -1314,7 +1314,7 @@ static struct object_entry *append_obj_to_pack(struct 
sha1file *f,
        sha1write(f, header, n);
        obj[0].size = size;
        obj[0].hdr_size = n;
-       obj[0].type = type;
+       obj[0].in_pack_type = type;
        obj[0].real_type = type;
        obj[1].idx.offset = obj[0].idx.offset + n;
        obj[1].idx.offset += write_compressed(f, buf, size);
@@ -1566,7 +1566,7 @@ static void show_pack_info(int stat_only)
        for (i = 0; i < nr_objects; i++) {
                struct object_entry *obj = &objects[i];
 
-               if (is_delta_type(obj->type))
+               if (is_delta_type(obj->in_pack_type))
                        chain_histogram[obj_stat[i].delta_depth - 1]++;
                if (stat_only)
                        continue;
@@ -1575,7 +1575,7 @@ static void show_pack_info(int stat_only)
                       typename(obj->real_type), obj->size,
                       (unsigned long)(obj[1].idx.offset - obj->idx.offset),
                       (uintmax_t)obj->idx.offset);
-               if (is_delta_type(obj->type)) {
+               if (is_delta_type(obj->in_pack_type)) {
                        struct object_entry *bobj = 
&objects[obj_stat[i].base_object_no];
                        printf(" %u %s", obj_stat[i].delta_depth, 
sha1_to_hex(bobj->idx.sha1));
                }
-- 
2.3.0.rc1.137.g477eb31

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to