src: Replace macros with util functions