Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Factor out and simplify loop scanning leading known empty values. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
1e6a22b0fc7a2c9774ab77922f2ab814 |
User & Date: | dgp 2017-06-16 15:51:12 |
Context
2017-06-16
| ||
16:07 | Split loop into two cases for further simplification. check-in: afd6a2812b user: dgp tags: trunk | |
15:51 | Factor out and simplify loop scanning leading known empty values. check-in: 1e6a22b0fc user: dgp tags: trunk | |
14:46 | Use local variables. check-in: af5aec752d user: dgp tags: trunk | |
Changes
Changes to generic/tclStringObj.c.
︙ | ︙ | |||
2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 | } } while (--oc); } else { Tcl_Obj *pendingPtr = NULL; /* Result will be concat of string reps. Pre-size it. */ ov = objv; oc = objc; do { int numBytes; Tcl_Obj *objPtr = *ov++; if ((length == 0) && (objPtr->bytes == NULL) && !pendingPtr) { /* No string rep; Take the chance we can avoid making it */ | > > > > > > > > > > > > > > > > > > > > | 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 | } } while (--oc); } else { Tcl_Obj *pendingPtr = NULL; /* Result will be concat of string reps. Pre-size it. */ ov = objv; oc = objc; do { /* assert ( pendingPtr == NULL ) */ /* assert ( length == 0 ) */ Tcl_Obj *objPtr = *ov++; if (objPtr->bytes == NULL) { /* No string rep; Take the chance we can avoid making it */ pendingPtr = objPtr; } else { Tcl_GetStringFromObj(objPtr, &length); /* PANIC? */ } } while (--oc && (length == 0) && (pendingPtr == NULL)); if (oc) { /* assert ( length > 0 || pendingPtr != NULL ) */ first = last = objc - oc - 1; do { int numBytes; Tcl_Obj *objPtr = *ov++; if ((length == 0) && (objPtr->bytes == NULL) && !pendingPtr) { /* No string rep; Take the chance we can avoid making it */ |
︙ | ︙ | |||
2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 | } } else if (numBytes > INT_MAX - length) { goto overflow; } length += numBytes; } } while (--oc); } if (last <= first /*|| length == 0 */) { /* Only one non-empty value or zero length; return first */ /* NOTE: (length == 0) implies (last <= first) */ *objPtrPtr = objv[first]; return TCL_OK; | > | 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 | } } else if (numBytes > INT_MAX - length) { goto overflow; } length += numBytes; } } while (--oc); } } if (last <= first /*|| length == 0 */) { /* Only one non-empty value or zero length; return first */ /* NOTE: (length == 0) implies (last <= first) */ *objPtrPtr = objv[first]; return TCL_OK; |
︙ | ︙ |