Move common basic functions into common/utils.c/h.