Fix bug.
This commit is contained in:
1 parent
d8c0c496d7
commit
ca08c62244
1 file changed
+9
-3
@@ -417,7 +417,12 @@
|
|||||||
it->index ++; \
|
it->index ++; \
|
||||||
if (M_UNLIKELY (it->index >= n->size)) { \
|
if (M_UNLIKELY (it->index >= n->size)) { \
|
||||||
n = deque_node_list_next_obj(it->deque->list, n); \
|
n = deque_node_list_next_obj(it->deque->list, n); \
|
||||||
if (M_UNLIKELY (n == NULL)) return; \
|
if (M_UNLIKELY (n == NULL)) { \
|
||||||
|
/* Point to 'end' (can't undo it) */ \
|
||||||
|
it->node = it->deque->back->node; \
|
||||||
|
it->index = it->deque->back->node->size; \
|
||||||
|
return; \
|
||||||
|
} \
|
||||||
it->node = n; \
|
it->node = n; \
|
||||||
it->index = 0; \
|
it->index = 0; \
|
||||||
} \
|
} \
|
||||||
@@ -485,16 +490,17 @@
|
|||||||
assert (d != NULL); \
|
assert (d != NULL); \
|
||||||
M_C(name, _node_list_init)(d->list); \
|
M_C(name, _node_list_init)(d->list); \
|
||||||
d->default_size = DEQUEUI_DEFAULT_SIZE + src->count; \
|
d->default_size = DEQUEUI_DEFAULT_SIZE + src->count; \
|
||||||
d->count = 0; \
|
d->count = src->count; \
|
||||||
deque_node_t *n = M_C(name, _int_new_node)(d); \
|
deque_node_t *n = M_C(name, _int_new_node)(d); \
|
||||||
if (n == NULL) return; \
|
if (n == NULL) return; \
|
||||||
|
d->default_size /= 2; \
|
||||||
deque_node_list_push_back(d->list, n); \
|
deque_node_list_push_back(d->list, n); \
|
||||||
d->front->node = n; \
|
d->front->node = n; \
|
||||||
d->front->index = DEQUEUI_DEFAULT_SIZE/2; \
|
d->front->index = DEQUEUI_DEFAULT_SIZE/2; \
|
||||||
d->back->node = n; \
|
d->back->node = n; \
|
||||||
d->back->index = DEQUEUI_DEFAULT_SIZE/2 + src->count; \
|
d->back->index = DEQUEUI_DEFAULT_SIZE/2 + src->count; \
|
||||||
it_t it; \
|
it_t it; \
|
||||||
size_t i = 0; \
|
size_t i = DEQUEUI_DEFAULT_SIZE/2; \
|
||||||
for(M_C(name, _it)(it, src); !M_C(name, _end_p)(it) ; M_C(name, _next)(it)) { \
|
for(M_C(name, _it)(it, src); !M_C(name, _end_p)(it) ; M_C(name, _next)(it)) { \
|
||||||
const type *obj = M_C(name, _cref)(it); \
|
const type *obj = M_C(name, _cref)(it); \
|
||||||
M_GET_INIT_SET oplist (n->data[i], *obj); \
|
M_GET_INIT_SET oplist (n->data[i], *obj); \
|
||||||
|
|||||||
Reference in new issue
Block a user