list: use typeof builtin

This fixes *tons* of compiler wornings and valgrind errors with clang.