Added linked list and stuff for debugging.

The linked list is similar to Linux kernel's /include/linux/list.h (which we can't use because Tox is GPLv3 and Linux is GPLv2 only.)

Also, I added WARNING() and ERROR() macros for debugging.