patch 8.2.3879: getreg() and getregtype() contain dead code

Problem:    getreg() and getregtype() contain dead code.
Solution:   Remove the needless check. (closes #9392)  Also refactor to put
            common code in a shared function.
diff --git a/src/version.c b/src/version.c
index e9d77a9..20c78d7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -750,6 +750,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    3879,
+/**/
     3878,
 /**/
     3877,