General purpose C language helper functions