list
list copied to clipboard
list_remove should check node to NULL
Because if I use list_remove(list, list_find(list, item))
it will break because list_find could return NULL
Currently we expect you to check the return value of list_find
:
list_node_t *thing = list_find(list, "value");
if (thing != NULL) {
list_remove(list, thing);
}
I think this is a reasonable thing to do. What is the use case for not checking the return value yourself?
A lib should be bullet proof and check for this kind of edge cases that's all. I just wanted to do it in one line of code, there's no need to repeat the same code over and over again.
Thanks :)
Feel free to open a PR :)