4 ms·
It is an error though if your code SEGFAULT on NULL head (and this one does). I wouldn't care, but if you claim to be defensive, go full monty.
by avip 10y ago
It is an error though if your code SEGFAULT on NULL head (and this one does).
I wouldn't care, but if you claim to be defensive, go full monty.
- eatbitseveryday 10y ago> It is an error though if your code SEGFAULT on NULL head (and this one does). There is no "SEGFAULT" in kernel code. SIGSEGV is a signal, which is only used at user-level. NULL dereference in the kernel results in an "oops". I believe it is also assumed in their code that "entry" is not going to be NULL, meaning "if (head == entry)" will never succeed if head is NULL.
- avip 10y agoThe code crashes if head is NULL, regardless of entry.