return llist_insert_back(list, sha1);
}
-/* computes A\B */
-void llist_sorted_difference_inplace(struct llist *A,
- struct llist *B)
-{
- struct llist_item *prev, *a, *b, *x;
-
- prev = a = A->front;
- b = B->front;
-
- while (a != NULL && b != NULL) {
- int cmp = memcmp(a->sha1, b->sha1, 20);
- if (!cmp) {
- x = a;
- if (a == A->front)
- A->front = a->next;
- a = prev->next = a->next;
-
- if (a == NULL) /* end of list */
- A->back = prev;
- A->size--;
- free(x);
- b = b->next;
- } else
- if (cmp > 0)
- b = b->next;
- else {
- prev = a;
- a = a->next;
- }
- }
-}
-
/* returns a pointer to an item in front of sha1 */
inline struct llist_item * llist_sorted_remove(struct llist *list, char *sha1,
struct llist_item *hint)
return prev;
}
+/* computes A\B */
+void llist_sorted_difference_inplace(struct llist *A,
+ struct llist *B)
+{
+ struct llist_item *hint, *b;
+
+ hint = NULL;
+ b = B->front;
+
+ while (b) {
+ hint = llist_sorted_remove(A, b->sha1, hint);
+ b = b->next;
+ }
+}
+
inline struct pack_list * pack_list_insert(struct pack_list **pl,
struct pack_list *entry)
{
minimize(&min);
if (verbose) {
- fprintf(stderr, "There are %ld packs available in alt-odbs.\n",
- pack_list_size(altodb_packs));
+ fprintf(stderr, "There are %lu packs available in alt-odbs.\n",
+ (unsigned long)pack_list_size(altodb_packs));
fprintf(stderr, "The smallest (bytewise) set of packs is:\n");
pl = min;
while (pl) {
fprintf(stderr, "\t%s\n", pl->pack->pack_name);
pl = pl->next;
}
- fprintf(stderr, "containing %ld duplicate objects "
- "with a total size of %ldkb.\n",
- get_pack_redundancy(min), pack_set_bytecount(min)/1024);
- fprintf(stderr, "A total of %ld unique objects were considered.\n",
- all_objects->size);
+ fprintf(stderr, "containing %lu duplicate objects "
+ "with a total size of %lukb.\n",
+ (unsigned long)get_pack_redundancy(min),
+ (unsigned long)pack_set_bytecount(min)/1024);
+ fprintf(stderr, "A total of %lu unique objects were considered.\n",
+ (unsigned long)all_objects->size);
fprintf(stderr, "Redundant packs (with indexes):\n");
}
pl = red = pack_list_difference(local_packs, min);