}
void
-queue_insertn(Queue *q, int pos, int n)
+queue_insertn(Queue *q, int pos, int n, Id *elements)
{
if (n <= 0)
return;
}
if (pos < q->count)
memmove(q->elements + pos + n, q->elements + pos, (q->count - pos) * sizeof(Id));
- memset(q->elements + pos, 0, n * sizeof(Id));
+ if (elements)
+ memcpy(q->elements + pos, elements, n * sizeof(Id));
+ else
+ memset(q->elements + pos, 0, n * sizeof(Id));
q->left -= n;
q->count += n;
}
extern void queue_insert(Queue *q, int pos, Id id);
extern void queue_insert2(Queue *q, int pos, Id id1, Id id2);
-extern void queue_insertn(Queue *q, int pos, int n);
+extern void queue_insertn(Queue *q, int pos, int n, Id *elements);
extern void queue_delete(Queue *q, int pos);
extern void queue_delete2(Queue *q, int pos);
extern void queue_deleten(Queue *q, int pos, int n);
{
if (q2.count)
queue_insert(&q2, 0, -marker);
- queue_insertn(&q2, 0, q->count);
- for (i = 0; i < q->count; i++)
- q2.elements[i] = q->elements[i];
+ queue_insertn(&q2, 0, q->count, q->elements);
}
repo_set_deparray(repo, p, keyname, &q2, 0);
queue_free(&q2);
*/
/* leave first element zero to make things easier */
/* also add trailing zero */
- queue_insertn(&edges, 0, 1 + count + 1);
+ queue_insertn(&edges, 0, 1 + count + 1, 0);
/* first requires and recommends */
for (i = 0; i < count; i++)
}
if (update_targets->count > 2)
solv_sort(update_targets->elements, update_targets->count >> 1, 2 * sizeof(Id), transform_update_targets_sortfn, solv);
- queue_insertn(update_targets, 0, installed->end - installed->start);
+ queue_insertn(update_targets, 0, installed->end - installed->start, 0);
lastp = lastq = 0;
for (i = j = installed->end - installed->start; i < update_targets->count; i += 2)
{
queue_init_clone(&solv->job, job);
solv->pooljobcnt = pool->pooljobs.count;
if (pool->pooljobs.count)
- {
- queue_insertn(&solv->job, 0, pool->pooljobs.count);
- memcpy(solv->job.elements, pool->pooljobs.elements, pool->pooljobs.count * sizeof(Id));
- }
+ queue_insertn(&solv->job, 0, pool->pooljobs.count, pool->pooljobs.elements);
job = &solv->job;
/* free old stuff */
return;
/* make room */
steps = &trans->steps;
- queue_insertn(steps, 0, max);
+ queue_insertn(steps, 0, max, 0);
/* now add em */
map_init(&done, installed->end - installed->start);