Revert "sv.c: Add cast to make C++ happy"

This reverts commit d49cfb746d789072c374f2403d477feb8017ce89.

Better patch coming.
Restructure hv_backreferences_p() so assert makes sense

Prior to this patch the assert was meaningless as we would
use the argument before we asserted things about it.

This patch restructures the logic so we do the asserts first
and *then* use the argument.
Rework sv_get_backrefs() so it is simpler, and C++ compliant

We unroll hv_backreferences_p() in sv_get_backrefs() so the logic is simpler,
(we dont need a **SV for this function), and (hopefully) make it C++ compliant
at the same time.