ivanseidel / LinkedList

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

getNode() --> return NULL pointer instead of bool "false" #25

Closed cmooney3 closed 5 years ago

cmooney3 commented 6 years ago

When compiling with this library I noticed a warning complaining about a "false" being typecast as a pointer and tracked it down. It looks like this was just a typo, and it should be returning a NULL pointer instead. After I replaced it with NULL, the warnings went away and from what I can tell everything is working just as expected.

FWIW the warning was:

n file included from /home/cmooney/installs/arduino-1.8.5/libraries/LaserMessaging/LaserMessaging.h:6:0, from /home/cmooney/installs/arduino-1.8.5/libraries/LaserMessaging/LaserMessaging.cpp:1: /home/cmooney/installs/arduino-1.8.5/libraries/LinkedList/LinkedList.h: In instantiation of 'ListNode LinkedList::getNode(int) [with T = unsigned int]': /home/cmooney/installs/arduino-1.8.5/libraries/LinkedList/LinkedList.h:308:38: required from 'T LinkedList::remove(int) [with T = unsigned int]' /home/cmooney/installs/arduino-1.8.5/libraries/LaserMessaging/LaserMessaging.cpp:235:25: required from here /home/cmooney/installs/arduino-1.8.5/libraries/LinkedList/LinkedList.h:167:9: warning: converting 'false' to pointer type 'ListNode' [-Wconversion-null] return false; ^

This CL just changes that "false" to a "NULL" and makes no other changes.

Signed-off-by: Charlie Mooney cmooney3@gmail.com

JasonThomasData commented 6 years ago

Bump.

I came here to check the PRs, so can confirm this is an issue.

Great library otherwise, thanks for making it.

ivanseidel commented 5 years ago

thanks! merged after a few months :)