Reduce code duplication; no functional changes.
Obtained from: NetBSD MFC after: 2 weeks Sponsored by: The FreeBSD Foundation