src/util: Refactor substitution into a macro