How to use list from sys/queue.h?
问题 Currently, I have implemented a singly linked list, like so: struct PeerNode { struct Peer* cargo; struct PeerNode* next; }; ...and I have a struct that contains a couple of these linked lists, like so: struct Torrent { ... struct PeerNode* peer_list; struct PeerNode* unchoked_peers; ... } I would like to replace this by using the macros provided by sys/queue.h . I gather that I could replace my code with something like this: struct Torrent { ... LIST_ENTRY(PeerNode, Peer) peer_list; struct