Permalink
Browse files

Fixed List_pop()

  • Loading branch information...
1 parent f588500 commit a308ba70f553a2cce742a64930656f506a4c93a7 @tj tj committed Aug 23, 2010
Showing with 2 additions and 2 deletions.
  1. +1 −1 src/list.c
  2. +1 −1 test.c
View
@@ -72,7 +72,7 @@ List_pop(List *self) {
if (!self->len) return NULL;
ListNode *node = self->tail;
if (--self->len) {
- self->tail = node->prev;
+ (self->tail = node->prev)->next = NULL;
} else {
self->tail = self->head = NULL;
}
View
2 test.c
@@ -215,7 +215,7 @@ test_List_pop() {
assert(a == list->head);
assert(b == list->tail);
assert(a == b->prev);
- // assert(NULL == b->next && "new tail node next is not NULL");
+ assert(NULL == list->tail->next && "new tail node next is not NULL");
assert(NULL == c->prev && "detached node prev is not NULL");
assert(NULL == c->next && "detached node next is not NULL");

0 comments on commit a308ba7

Please sign in to comment.