diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-02-17 09:51:40 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-02-17 09:51:40 (GMT) |
commit | 721b319dcb44dc8af3446dbc91de321fd6a5b707 (patch) | |
tree | 891c88867d71742a1d9b34fe85f247a38c655a39 | |
parent | d36751c671764d5351700a2ca73e18f78bd6aae8 (diff) | |
parent | 8fd0500bc8b2821f46d079ebc6b19bb39a25152e (diff) | |
download | tcl-721b319dcb44dc8af3446dbc91de321fd6a5b707.zip tcl-721b319dcb44dc8af3446dbc91de321fd6a5b707.tar.gz tcl-721b319dcb44dc8af3446dbc91de321fd6a5b707.tar.bz2 |
Merge 8.6. Remove some Tcl_Panic()'s which can never happen
-rw-r--r-- | generic/tclScan.c | 3 | ||||
-rw-r--r-- | generic/tclStrToD.c | 17 |
2 files changed, 8 insertions, 12 deletions
diff --git a/generic/tclScan.c b/generic/tclScan.c index 134f60d..6bc914d 100644 --- a/generic/tclScan.c +++ b/generic/tclScan.c @@ -916,9 +916,10 @@ Tcl_ScanObjCmd( } if (flags & SCAN_LONGER) { if (Tcl_GetWideIntFromObj(NULL, objPtr, &wideValue) != TCL_OK) { - wideValue = WIDE_MAX; if (TclGetString(objPtr)[0] == '-') { wideValue = WIDE_MIN; + } else { + wideValue = WIDE_MAX; } } if ((flags & SCAN_UNSIGNED) && (wideValue < 0)) { diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 32e6701..5ee5945 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -543,8 +543,7 @@ TclParseNumber( int under = 0; /* Flag trailing '_' as error if true once * number is accepted. */ -#define ALL_BITS UWIDE_MAX -#define MOST_BITS (ALL_BITS >> 1) +#define MOST_BITS (UWIDE_MAX >> 1) /* * Initialize bytes to start of the object's string rep if the caller @@ -915,7 +914,7 @@ TclParseNumber( acceptState = state; acceptPoint = p; acceptLen = len; - /* FALLTHRU */ + /* FALLTHRU */ case ZERO_B: zerob: if (c == '0') { @@ -3852,15 +3851,13 @@ ShouldBankerRoundUp( int r = mp_cmp_mag(twor, S); switch (r) { - case MP_LT: - return 0; case MP_EQ: return isodd; case MP_GT: return 1; + default: + return 0; } - Tcl_Panic("in ShouldBankerRoundUp, trichotomy fails!"); - return 0; } /* @@ -3898,15 +3895,13 @@ ShouldBankerRoundUpToNext( r = mp_cmp_mag(&temp, S); mp_clear(&temp); switch(r) { - case MP_LT: - return 0; case MP_EQ: return isodd; case MP_GT: return 1; + default: + return 0; } - Tcl_Panic("in ShouldBankerRoundUpToNext, trichotomy fails!"); - return 0; } /* |