This make list item handling more strict, hopefully preventing unexpected behavior becuase of uninitialized memory, and making it easier to debug such issues. List item usage rules: - A list item must be initialized using new nn_list_item_init(), replacing nn_list_item_nil(). - If you ignore the rule above, inserting an uninitialized list item assert :-) - A list item should be terminated using new nn_list_item_term(). This function assert that the item is nill and is not part of any list. Implementation changes: To support static initalization, NN_LIST_INITIALIZER macro was added. The special nil list item value was changed to -1 (0xffffffffffffffff). This make it easier to expose the value for other modules in a safe way, and to detect nil items while debugging. This also ensure that code trying to use nil list item will segfault. All code was modified to initialize and terminate list items properly. Note that the best place to terminate list item is not always clear, as some objects not have a termination function (e.g. xxx_term). This part of the patch needs good review. The patch reveal possible data race in the tcp_shutdown test - the test fails now when trying to insert an invalid list item: next = 0xffffffffffffffff, prev = 0x23ffffffffffff License: MIT
Attachment:
0005-More-stric-list-item-handling.patch
Description: Binary data