Refactoring of str.h/str.c