{
list_set_array(&importer->package->properties,
&importer->set->property_pool,
- &importer->properties);
+ &importer->properties,
+ 1);
array_release(&importer->properties);
}
}
free(map);
- up++;
+ if (up != rp)
+ up++;
set->properties.size = (void *) up - set->properties.data;
rp_end = up;
for (rp = set->properties.data, p = pkgs; rp < rp_end; rp++, p++) {
- list_set_array(&rp->packages, &set->package_pool, p);
+ list_set_array(&rp->packages, &set->package_pool, p, 0);
array_release(p);
}
e->start = p->count > 0 ? s : 0;
s += p->count;
- list_set_array(&e->packages, &set->package_pool, &p->packages);
+ list_set_array(&e->packages, &set->package_pool, &p->packages, 0);
array_release(&p->packages);
p++;
}
packages = set->packages.data;
for (i = 0; i < count; i++) {
- list_set_array(&packages[i].files, &set->file_pool, &pkgs[i]);
+ list_set_array(&packages[i].files, &set->file_pool, &pkgs[i], 0);
array_release(&pkgs[i]);
}
free(pkgs);
send = source1->set->packages.data + source1->set->packages.size;
spool = source1->set->string_pool.data;
- while (s < send) {
+ while (s < send || u < uend) {
p = upstream_packages + *u;
- if (u < uend)
+ if (s < send && u < uend)
cmp = strcmp(&spool[s->name], &upool[p->name]);
- if (u >= uend || cmp < 0) {
+ else if (s < send)
+ cmp = -1;
+ else
+ cmp = 1;
+ if (cmp < 0) {
add_package(merger, s, source1, 0);
s++;
} else if (cmp == 0) {
prop_end = set->properties.data + set->properties.size;
a = pkgs;
for (prop = set->properties.data; prop < prop_end; prop++, a++) {
- list_set_array(&prop->packages, pool, a);
+ list_set_array(&prop->packages, pool, a, 0);
array_release(a);
}
free(pkgs);
}
void
-list_set_array(struct list_head *head, struct array *pool, struct array *items)
+list_set_array(struct list_head *head, struct array *pool,
+ struct array *items, int force_indirect)
{
struct list *p;
- if (items->size == 0) {
- list_set_empty(head);
- } else if (items->size == sizeof (uint32_t)) {
- head->list_ptr = *(uint32_t *) items->data;
- head->flags = RAZOR_IMMEDIATE;
- } else {
- p = array_add(pool, items->size);
- memcpy(p, items->data, items->size);
- p[items->size / sizeof *p - 1].flags = RAZOR_ENTRY_LAST;
- list_set_ptr(head, p - (struct list *) pool->data);
+ if (!force_indirect) {
+ if (items->size == 0) {
+ list_set_empty(head);
+ return;
+ } else if (items->size == sizeof (uint32_t)) {
+ head->list_ptr = *(uint32_t *) items->data;
+ head->flags = RAZOR_IMMEDIATE;
+ return;
+ }
}
+
+ p = array_add(pool, items->size);
+ memcpy(p, items->data, items->size);
+ p[items->size / sizeof *p - 1].flags = RAZOR_ENTRY_LAST;
+ list_set_ptr(head, p - (struct list *) pool->data);
}
struct list *
void list_set_empty(struct list_head *head);
void list_set_ptr(struct list_head *head, uint32_t ptr);
-void list_set_array(struct list_head *head, struct array *pool, struct array *items);
+void list_set_array(struct list_head *head, struct array *pool, struct array *items, int force_indirect);
struct list *list_first(struct list_head *head, struct array *pool);
struct list *list_next(struct list *list);