From: Nicholas Clark Date: Fri, 18 Nov 2005 10:30:12 +0000 (+0000) Subject: const and static for the const static private table. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=99dcd71a41191ce655a81441c911fe0ae4668bcf;p=p5sagit%2Fp5-mst-13.2.git const and static for the const static private table. 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 --- diff --git a/sv.c b/sv.c index 6498a46..e7355b7 100644 --- 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;