nit: indentation issue?  Perhaps run the file through uncrustify