add my own impl of strdup
change API of xh_begin
change xh_next's usage
refactor test