summaryrefslogtreecommitdiff
path: root/pp_pack.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-01-13 22:39:58 +0000
committerNicholas Clark <nick@ccl4.org>2005-01-13 22:39:58 +0000
commitc75bde89ee55ab4c3ff1da2c3438b11554305529 (patch)
tree32c61a714c782419077608c30ae0fd6e77ec8fc9 /pp_pack.c
parentac7f3b1b093ac3b3a306d564a043e7f8c12a02c6 (diff)
downloadperl-c75bde89ee55ab4c3ff1da2c3438b11554305529.tar.gz
Turn the unreachable code into assertions. (So prove me wrong...)
p4raw-id: //depot/perl@23794
Diffstat (limited to 'pp_pack.c')
-rw-r--r--pp_pack.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/pp_pack.c b/pp_pack.c
index 2d367ad1ca..9304d9fd3a 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)));