diff: unify external diff and funcname parsing code