ivanseidel / LinkedList

🔗 A fully implemented LinkedList made to work with general Microcontrollers and Arduino projects
MIT License
350 stars 118 forks source link

Fix bug in unshift #20

Closed sidoh closed 7 years ago

sidoh commented 7 years ago

Set prev on old root in unshift. Using unshift on a non-empty list didn't update the previous pointer of the old root to the newly added node.

ivanseidel commented 7 years ago

thanks!

sidoh commented 7 years ago

lol, that was fast.

thanks!

sidoh commented 7 years ago

I just realized this is wrong. I made a local copy of this code a few weeks ago and made some changes I lost track of. One of those was making the list doubly linked. So the bug was only in my local copy, and there's not actually a root->prev to speak of in your code.

Probably want to revert this. Sorry for the trouble!