Update the assertion to a croak "Out of range special SV number"
authorNicholas Clark <nick@ccl4.org>
Sat, 15 Apr 2006 20:54:44 +0000 (20:54 +0000)
committerNicholas Clark <nick@ccl4.org>
Sat, 15 Apr 2006 20:54:44 +0000 (20:54 +0000)
to give ByteLoader more meaningful failure diagnostics.

p4raw-id: //depot/perl@27822

ext/ByteLoader/bytecode.h

index 1d06b088771ddf9698cdf1409d7beed9f3139dc0..3e6f9d9e334efe20e62175faa41d81098d12c061 100644 (file)
@@ -91,9 +91,11 @@ typedef char *pvindex;
        arg = arg ? savepv(arg) : arg;                  \
     } STMT_END
 
-#define BSET_ldspecsv(sv, arg) STMT_START {                              \
-       assert(arg < sizeof(specialsv_list) / sizeof(specialsv_list[0])); \
-       sv = specialsv_list[arg];                                         \
+#define BSET_ldspecsv(sv, arg) STMT_START {                            \
+       if(arg >= sizeof(specialsv_list) / sizeof(specialsv_list[0])) { \
+           Perl_croak(aTHX_ "Out of range special SV number %d", arg); \
+       }                                                               \
+       sv = specialsv_list[arg];                                       \
     } STMT_END
 
 #define BSET_ldspecsvx(sv, arg) STMT_START {   \