- if (index_size < 4*256 + 20)
- return error("index file too small");
- nr = 0;
- for (i = 0; i < 256; i++) {
- unsigned int n = ntohl(array[i]);
- if (n < nr)
- return error("non-monotonic index");
- nr = n;
- }
- /*
- * Total size:
- * - 256 index entries 4 bytes each
- * - 24-byte entries * nr (20-byte sha1 + 4-byte offset)
- * - 20-byte SHA1 of the packfile
- * - 20-byte SHA1 file checksum
- */
- if (index_size != 4*256 + nr * 24 + 20 + 20)
- return error("wrong index file size");
-
- nr_entries = nr;
- pack_list = xmalloc(nr * sizeof(struct pack_entry *));
- for (i = 0; i < nr; i++)
- pack_list[i] = index_base + 4*256 + i*24;
-
- qsort(pack_list, nr, sizeof(*pack_list), sort_by_offset);
-
- printf("%d entries\n", nr);
- return 0;
+ memcpy(info->base_sha1, base_sha1, 20);
+ info->size = size;
+ info->delta = delta;
+ info->next = delta_list;
+ delta_list = info;