Replace some defines with inline functions