News for hackers. Stuff that matters.
Re:Applying the Linus Torvalds “Good Taste” Coding Requirement by Nursie on Wednesday October 26, 2016 @07:00AM (#12795481)
If entry and head are null, segfault on line 4.

If entry is null and head is valid segfault on line 10.

--edit--

As pointed out by my esteemed colleagues below, I didn't read the loop conditional properly. Only the first fault applies

Re:Applying the Linus Torvalds “Good Taste” Coding Requirement by A1kmm on Wednesday October 26, 2016 @07:22AM (#12795564)
> If entry is null and head is valid segfault on line 10.

To get to line 10, we need prev->next == entry. Since we are talking about the case where entry == NULL, that requires prev->next == NULL

The for loop condition is prev->next, which will fail if prev->next == NULL, hence line 10 would never be reached in that case.

The difficulty of analysing all of this shows why mutable structures and variables make code hard to follow - perhaps the real good taste solution is to use something like finger trees instead of linked lists, together with a language which eliminates null.

Re:Applying the Linus Torvalds “Good Taste” Coding Requirement by jakobegger on Wednesday October 26, 2016 @07:31AM (#12795596)
How can you reach line 10 when entry is NULL?

(prev->next==entry) can only be true at the end of the list, but the for-condition already checks that.