xdiff: factor out match_func_rec()