make opensnap properly compile with c99 and GNU_COURCE
refactor code slightly