A bunch of small fixes from my android branch

Add support for thread names (linux only)
Fix some unsafe array access operations
Add support for doubleclick exit of formspecs (usefull primary for touchscreen environments)
Use iterators to access vectors to avoid compiler to generate temporarys
Remove a lot of temporarys in guiformspecmenu
Minor fixes
Lots of whitespace fixes
Code cleanup

Case some of the changes are controversial I will provide singular patches for the non controversial ones too.