Doubly-linked list implementation in C