2 * Copyright (c) 2007, Novell Inc.
4 * This program is licensed under the BSD license, read LICENSE.BSD
5 * for further information
20 queue_clone(Queue *t, Queue *s)
22 t->alloc = t->elements = sat_malloc2(s->count + 8, sizeof(Id));
24 memcpy(t->alloc, s->elements, s->count * sizeof(Id));
32 q->alloc = q->elements = 0;
33 q->count = q->left = 0;
37 queue_init_buffer(Queue *q, Id *buf, int size)
50 q->alloc = q->elements = 0;
51 q->count = q->left = 0;
55 queue_alloc_one(Queue *q)
57 if (q->alloc && q->alloc != q->elements)
59 memmove(q->alloc, q->elements, q->count * sizeof(Id));
60 q->left += q->elements - q->alloc;
61 q->elements = q->alloc;
65 q->elements = q->alloc = sat_realloc2(q->alloc, q->count + 8, sizeof(Id));
70 q->alloc = sat_malloc2(q->count + 8, sizeof(Id));
72 memcpy(q->alloc, q->elements, q->count * sizeof(Id));
73 q->elements = q->alloc;