const and static for the const static private table.
authorNicholas Clark <nick@ccl4.org>
Fri, 18 Nov 2005 10:30:12 +0000 (10:30 +0000)
committerNicholas Clark <nick@ccl4.org>
Fri, 18 Nov 2005 10:30:12 +0000 (10:30 +0000)
Replace the "upgrade" special case for SVt_PV with assertions as it's
not been needed since we forced *up*grades.

p4raw-id: //depot/perl@26156

sv.c

diff --git a/sv.c b/sv.c
index 6498a46..e7355b7 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -1231,7 +1231,7 @@ struct body_details {
     bool zero_nv;      /* zero the NV when upgrading from this */
 };
 
-struct body_details bodies_by_type[] = {
+static const struct body_details bodies_by_type[] = {
     {0, 0, 0, FALSE, TRUE},
     /* IVs are in the head, so the allocation size is 0  */
     {0, sizeof(IV), -STRUCT_OFFSET(XPVIV, xiv_iv), FALSE, TRUE},
@@ -1472,10 +1472,9 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 new_type)
     case SVt_RV:
        break;
     case SVt_PV:
-       if (new_type <= SVt_IV)
-           new_type = SVt_PVIV;
-       else if (new_type == SVt_NV)
-           new_type = SVt_PVNV;
+       assert(new_type > SVt_PV);
+       assert(SVt_IV < SVt_PV);
+       assert(SVt_NV < SVt_PV);
        break;
     case SVt_PVIV:
        break;