Remove gnuisms
More of an "in case anybody finds this useful" merge request, did this for my own work on the example and thought i might contribute something to this great example! Otherwise feel free to just close if the code was intended to be gnu C. But it also fixes some white-space inconsistencies and a theoretical use-after-free in the case of an error around device.c:126.