fix compiler errors on ubuntu precise

replace NULL with 0, remove unused variable
strip trailing whitespace