pack: convert struct pack_idx_entry to struct object_id
Convert struct pack_idx_entry to use struct object_id by changing the definition and applying the following semantic patch, plus the standard object_id transforms: @@ struct pack_idx_entry E1; @@ - E1.sha1 + E1.oid.hash @@ struct pack_idx_entry *E1; @@ - E1->sha1 + E1->oid.hash Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
bc83266abe
commit
e6a492b7be
@@ -14,7 +14,7 @@ static uint32_t locate_object_entry_hash(struct packing_data *pdata,
|
||||
while (pdata->index[i] > 0) {
|
||||
uint32_t pos = pdata->index[i] - 1;
|
||||
|
||||
if (!hashcmp(sha1, pdata->objects[pos].idx.sha1)) {
|
||||
if (!hashcmp(sha1, pdata->objects[pos].idx.oid.hash)) {
|
||||
*found = 1;
|
||||
return i;
|
||||
}
|
||||
@@ -53,7 +53,9 @@ static void rehash_objects(struct packing_data *pdata)
|
||||
|
||||
for (i = 0; i < pdata->nr_objects; i++) {
|
||||
int found;
|
||||
uint32_t ix = locate_object_entry_hash(pdata, entry->idx.sha1, &found);
|
||||
uint32_t ix = locate_object_entry_hash(pdata,
|
||||
entry->idx.oid.hash,
|
||||
&found);
|
||||
|
||||
if (found)
|
||||
die("BUG: Duplicate object in hash");
|
||||
@@ -98,7 +100,7 @@ struct object_entry *packlist_alloc(struct packing_data *pdata,
|
||||
new_entry = pdata->objects + pdata->nr_objects++;
|
||||
|
||||
memset(new_entry, 0, sizeof(*new_entry));
|
||||
hashcpy(new_entry->idx.sha1, sha1);
|
||||
hashcpy(new_entry->idx.oid.hash, sha1);
|
||||
|
||||
if (pdata->index_size * 3 <= pdata->nr_objects * 4)
|
||||
rehash_objects(pdata);
|
||||
|
||||
Reference in New Issue
Block a user