From: Nicholas Clark Date: Thu, 13 Jan 2005 22:39:58 +0000 (+0000) Subject: Turn the unreachable code into assertions. (So prove me wrong...) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c75bde89ee55ab4c3ff1da2c3438b11554305529;p=p5sagit%2Fp5-mst-13.2.git Turn the unreachable code into assertions. (So prove me wrong...) p4raw-id: //depot/perl@23794 --- diff --git a/pp_pack.c b/pp_pack.c index 2d367ad..9304d9f 100644 --- a/pp_pack.c +++ b/pp_pack.c @@ -1510,15 +1510,10 @@ S_unpack_rec(pTHX_ register tempsym_t* symptr, register char *s, char *strbeg, c EXTEND_MORTAL(len); } while (len-- > 0) { - if (s + sizeof(Quad_t) > strend) { - /* Surely this should never happen? NWC */ - aquad = 0; - } - else { - Copy(s, &aquad, 1, Quad_t); - DO_BO_UNPACK(aquad, 64); - s += sizeof(Quad_t); - } + assert (s + sizeof(Quad_t) <= strend); + Copy(s, &aquad, 1, Quad_t); + DO_BO_UNPACK(aquad, 64); + s += sizeof(Quad_t); if (!checksum) { PUSHs(sv_2mortal((aquad >= IV_MIN && aquad <= IV_MAX) ? newSViv((IV)aquad) : newSVnv((NV)aquad))); @@ -1540,13 +1535,10 @@ S_unpack_rec(pTHX_ register tempsym_t* symptr, register char *s, char *strbeg, c EXTEND_MORTAL(len); } while (len-- > 0) { - if (s + sizeof(Uquad_t) > strend) - auquad = 0; - else { - Copy(s, &auquad, 1, Uquad_t); - DO_BO_UNPACK(auquad, 64); - s += sizeof(Uquad_t); - } + assert (s + sizeof(Uquad_t) <= strend); + Copy(s, &auquad, 1, Uquad_t); + DO_BO_UNPACK(auquad, 64); + s += sizeof(Uquad_t); if (!checksum) { PUSHs(sv_2mortal((auquad <= UV_MAX) ? newSVuv((UV)auquad) : newSVnv((NV)auquad)));