diff options
author | dgp <dgp@users.sourceforge.net> | 2017-07-06 16:47:21 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2017-07-06 16:47:21 (GMT) |
commit | ba092b7b1d40787c83c07c2b851ede96c1b0f6e5 (patch) | |
tree | a7373f9437bfb9113491b6f8de5d17268e417146 | |
parent | dc423cbb0f73bd96b52a63f446b2c96204ebf703 (diff) | |
parent | daaac6f4c23110b1489e943f514c4b8befc14b2d (diff) | |
download | tcl-ba092b7b1d40787c83c07c2b851ede96c1b0f6e5.zip tcl-ba092b7b1d40787c83c07c2b851ede96c1b0f6e5.tar.gz tcl-ba092b7b1d40787c83c07c2b851ede96c1b0f6e5.tar.bz2 |
merge 8.6
-rw-r--r-- | generic/tclPathObj.c | 60 | ||||
-rw-r--r-- | generic/tclStrToD.c | 52 | ||||
-rw-r--r-- | generic/tclUtf.c | 4 |
3 files changed, 58 insertions, 58 deletions
diff --git a/generic/tclPathObj.c b/generic/tclPathObj.c index 31ed68e..8ee4869 100644 --- a/generic/tclPathObj.c +++ b/generic/tclPathObj.c @@ -13,6 +13,7 @@ #include "tclInt.h" #include "tclFileSystem.h" +#include <assert.h> /* * Prototypes for functions defined later in this file. @@ -849,18 +850,20 @@ TclJoinPath( int elements, Tcl_Obj * const objv[]) { - Tcl_Obj *res; + Tcl_Obj *res = NULL; int i; const Tcl_Filesystem *fsPtr = NULL; - res = NULL; + assert ( elements >= 0 ); - for (i = 0; i < elements; i++) { - int driveNameLength, strEltLen, length; - Tcl_PathType type; - char *strElt, *ptr; - Tcl_Obj *driveName = NULL; - Tcl_Obj *elt = objv[i]; + if (elements == 0) { + return Tcl_NewObj(); + } + + assert ( elements > 0 ); + + if (elements == 2) { + Tcl_Obj *elt = objv[0]; /* * This is a special case where we can be much more efficient, where @@ -869,18 +872,17 @@ TclJoinPath( * object which can be normalized more efficiently. Currently we only * use the special case when we have exactly two elements, but we * could expand that in the future. - * - * Bugfix [a47641a0]. TclNewFSPathObj requires first argument - * to be an absolute path. Added a check for that elt is absolute. + * + * Bugfix [a47641a0]. TclNewFSPathObj requires first argument + * to be an absolute path. Added a check for that elt is absolute. */ - if ((i == (elements-2)) && (i == 0) - && (elt->typePtr == &tclFsPathType) + if ((elt->typePtr == &tclFsPathType) && !((elt->bytes != NULL) && (elt->bytes[0] == '\0')) && TclGetPathType(elt, NULL, NULL, NULL) == TCL_PATH_ABSOLUTE) { - Tcl_Obj *tailObj = objv[i+1]; + Tcl_Obj *tailObj = objv[1]; + Tcl_PathType type = TclGetPathType(tailObj, NULL, NULL, NULL); - type = TclGetPathType(tailObj, NULL, NULL, NULL); if (type == TCL_PATH_RELATIVE) { const char *str; int len; @@ -893,9 +895,6 @@ TclJoinPath( * the base itself is just fine! */ - if (res != NULL) { - TclDecrRefCount(res); - } return elt; } @@ -918,9 +917,6 @@ TclJoinPath( if ((tclPlatform != TCL_PLATFORM_WINDOWS) || (strchr(Tcl_GetString(elt), '\\') == NULL)) { - if (res != NULL) { - TclDecrRefCount(res); - } if (PATHFLAGS(elt)) { return TclNewFSPathObj(elt, str, len); @@ -940,23 +936,28 @@ TclJoinPath( * more general code below handle things. */ } else if (tclPlatform == TCL_PLATFORM_UNIX) { - if (res != NULL) { - TclDecrRefCount(res); - } return tailObj; } else { const char *str = TclGetString(tailObj); if (tclPlatform == TCL_PLATFORM_WINDOWS) { if (strchr(str, '\\') == NULL) { - if (res != NULL) { - TclDecrRefCount(res); - } return tailObj; } } } } + } + + assert ( res == NULL ); + + for (i = 0; i < elements; i++) { + int driveNameLength, strEltLen, length; + Tcl_PathType type; + char *strElt, *ptr; + Tcl_Obj *driveName = NULL; + Tcl_Obj *elt = objv[i]; + strElt = Tcl_GetStringFromObj(elt, &strEltLen); driveNameLength = 0; type = TclGetPathType(elt, &fsPtr, &driveNameLength, &driveName); @@ -1087,6 +1088,7 @@ TclJoinPath( if (sep != NULL) { separator = TclGetString(sep)[0]; + Tcl_DecrRefCount(sep); } /* Safety check in case the VFS driver caused sharing */ if (Tcl_IsShared(res)) { @@ -1122,9 +1124,7 @@ TclJoinPath( Tcl_SetObjLength(res, length); } } - if (res == NULL) { - res = Tcl_NewObj(); - } + assert ( res != NULL ); return res; } diff --git a/generic/tclStrToD.c b/generic/tclStrToD.c index 2091928..5d601e4 100644 --- a/generic/tclStrToD.c +++ b/generic/tclStrToD.c @@ -1973,7 +1973,7 @@ RefineApproximation( *---------------------------------------------------------------------- */ -inline static void +static inline void MulPow5( mp_int *base, /* Number to multiply. */ unsigned n, /* Power of 5 to multiply by. */ @@ -2018,7 +2018,7 @@ MulPow5( *---------------------------------------------------------------------- */ -inline static int +static inline int NormalizeRightward( Tcl_WideUInt *wPtr) /* INOUT: Number to shift. */ { @@ -2109,7 +2109,7 @@ RequiredPrecision( *---------------------------------------------------------------------- */ -inline static void +static inline void DoubleToExpAndSig( double dv, /* Number to convert. */ Tcl_WideUInt *significand, /* OUTPUT: Significand of the number. */ @@ -2157,7 +2157,7 @@ DoubleToExpAndSig( *---------------------------------------------------------------------- */ -inline static void +static inline void TakeAbsoluteValue( Double *d, /* Number to replace with absolute value. */ int *sign) /* Place to put the signum. */ @@ -2188,7 +2188,7 @@ TakeAbsoluteValue( *---------------------------------------------------------------------- */ -inline static char * +static inline char * FormatInfAndNaN( Double *d, /* Exceptional number to format. */ int *decpt, /* Decimal point to set to a bogus value. */ @@ -2230,7 +2230,7 @@ FormatInfAndNaN( *---------------------------------------------------------------------- */ -inline static char * +static inline char * FormatZero( int *decpt, /* Location of the decimal point. */ char **endPtr) /* Pointer to the end of the formatted data */ @@ -2260,7 +2260,7 @@ FormatZero( *---------------------------------------------------------------------- */ -inline static int +static inline int ApproximateLog10( Tcl_WideUInt bw, /* Integer significand of the number. */ int be, /* Power of two to scale bw. */ @@ -2308,7 +2308,7 @@ ApproximateLog10( *---------------------------------------------------------------------- */ -inline static int +static inline int BetterLog10( double d, /* Original number to format. */ int k, /* Characteristic(Log base 10) of the @@ -2351,7 +2351,7 @@ BetterLog10( *---------------------------------------------------------------------- */ -inline static void +static inline void ComputeScale( int be, /* Exponent part of number: d = bw * 2**be. */ int k, /* Characteristic of log10(number). */ @@ -2414,7 +2414,7 @@ ComputeScale( *---------------------------------------------------------------------- */ -inline static void +static inline void SetPrecisionLimits( int convType, /* Type of conversion: TCL_DD_SHORTEST, * TCL_DD_STEELE0, TCL_DD_E_FMT, @@ -2475,7 +2475,7 @@ SetPrecisionLimits( *---------------------------------------------------------------------- */ -inline static char * +static inline char * BumpUp( char *s, /* Cursor pointing one past the end of the * string. */ @@ -2509,7 +2509,7 @@ BumpUp( *---------------------------------------------------------------------- */ -inline static int +static inline int AdjustRange( double *dPtr, /* INOUT: Number to adjust. */ int k) /* IN: floor(log10(d)) */ @@ -2582,7 +2582,7 @@ AdjustRange( *---------------------------------------------------------------------- */ -inline static char * +static inline char * ShorteningQuickFormat( double d, /* Number to convert. */ int k, /* floor(log10(d)) */ @@ -2657,7 +2657,7 @@ ShorteningQuickFormat( *---------------------------------------------------------------------- */ -inline static char * +static inline char * StrictQuickFormat( double d, /* Number to convert. */ int k, /* floor(log10(d)) */ @@ -2731,7 +2731,7 @@ StrictQuickFormat( *---------------------------------------------------------------------- */ -inline static char * +static inline char * QuickConversion( double e, /* Number to format. */ int k, /* floor(log10(d)), approximately. */ @@ -2836,7 +2836,7 @@ QuickConversion( *---------------------------------------------------------------------- */ -inline static void +static inline void CastOutPowersOf2( int *b2, /* Power of 2 to multiply the significand. */ int *m2, /* Power of 2 to multiply 1/2 ulp. */ @@ -2880,7 +2880,7 @@ CastOutPowersOf2( *---------------------------------------------------------------------- */ -inline static char * +static inline char * ShorteningInt64Conversion( Double *dPtr, /* Original number to convert. */ int convType, /* Type of conversion (shortest, Steele, @@ -3049,7 +3049,7 @@ ShorteningInt64Conversion( *---------------------------------------------------------------------- */ -inline static char * +static inline char * StrictInt64Conversion( Double *dPtr, /* Original number to convert. */ int convType, /* Type of conversion (shortest, Steele, @@ -3155,7 +3155,7 @@ StrictInt64Conversion( *---------------------------------------------------------------------- */ -inline static int +static inline int ShouldBankerRoundUpPowD( mp_int *b, /* Numerator of the fraction. */ int sd, /* Denominator is 2**(sd*DIGIT_BIT). */ @@ -3193,7 +3193,7 @@ ShouldBankerRoundUpPowD( *---------------------------------------------------------------------- */ -inline static int +static inline int ShouldBankerRoundUpToNextPowD( mp_int *b, /* Numerator of the fraction. */ mp_int *m, /* Numerator of the rounding tolerance. */ @@ -3256,7 +3256,7 @@ ShouldBankerRoundUpToNextPowD( *---------------------------------------------------------------------- */ -inline static char * +static inline char * ShorteningBignumConversionPowD( Double *dPtr, /* Original number to convert. */ int convType, /* Type of conversion (shortest, Steele, @@ -3449,7 +3449,7 @@ ShorteningBignumConversionPowD( *---------------------------------------------------------------------- */ -inline static char * +static inline char * StrictBignumConversionPowD( Double *dPtr, /* Original number to convert. */ int convType, /* Type of conversion (shortest, Steele, @@ -3565,7 +3565,7 @@ StrictBignumConversionPowD( *---------------------------------------------------------------------- */ -inline static int +static inline int ShouldBankerRoundUp( mp_int *twor, /* 2x the remainder from thd division that * produced the last digit. */ @@ -3600,7 +3600,7 @@ ShouldBankerRoundUp( *---------------------------------------------------------------------- */ -inline static int +static inline int ShouldBankerRoundUpToNext( mp_int *b, /* Remainder from the division that produced * the last digit. */ @@ -3654,7 +3654,7 @@ ShouldBankerRoundUpToNext( *---------------------------------------------------------------------- */ -inline static char * +static inline char * ShorteningBignumConversion( Double *dPtr, /* Original number being converted. */ int convType, /* Conversion type. */ @@ -3870,7 +3870,7 @@ ShorteningBignumConversion( *---------------------------------------------------------------------- */ -inline static char * +static inline char * StrictBignumConversion( Double *dPtr, /* Original number being converted. */ int convType, /* Conversion type. */ diff --git a/generic/tclUtf.c b/generic/tclUtf.c index b13ad75..b8b867c 100644 --- a/generic/tclUtf.c +++ b/generic/tclUtf.c @@ -98,7 +98,7 @@ static int UtfCount(int ch); *--------------------------------------------------------------------------- */ -INLINE static int +static inline int UtfCount( int ch) /* The Tcl_UniChar whose size is returned. */ { @@ -134,7 +134,7 @@ UtfCount( *--------------------------------------------------------------------------- */ -INLINE int +int Tcl_UniCharToUtf( int ch, /* The Tcl_UniChar to be stored in the * buffer. */ |