Use correct prototypes
return NULL over -1
Merge remote-tracking branch 'richo/bugs/compiler_warnings'