Tcl Source Code

Check-in [aa9699939f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Rework the logic. Equivalent function.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: aa9699939fb4c3445966087fa39b58f2d7ed0a29
User & Date: dgp 2017-06-16 14:43:16
Context
2017-06-16
14:46
Use local variables. check-in: af5aec752d user: dgp tags: trunk
14:43
Rework the logic. Equivalent function. check-in: aa9699939f user: dgp tags: trunk
12:56
Extend cases where string rep generation can be prevented. check-in: 3f07499767 user: dgp tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclStringObj.c.

2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992

2993




2994
2995
2996
2997
2998
2999
3000

		last = objc - oc;
		first = last;
		pendingPtr = objPtr;
	    } else {

		Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */
		if (numBytes == 0) {
		    if (pendingPtr && pendingPtr->bytes) {
			/*
			 * Generating string rep of objPtr also 
			 * generated string rep of pendingPtr.
			 */
			if (pendingPtr->length) {
			    /* Can this happen? */
			    goto foo;
			} else {
			    /* string-29.14 */
			    first = objc - 1;
			    last = 0;
			    pendingPtr = NULL;
			}
		    }
		    continue;
		}
		last = objc - oc;
foo:
		if (pendingPtr) {
		    Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */
		    pendingPtr = NULL;
		}
		if (length == 0) {

		    first = last;




		} else if (numBytes > INT_MAX - length) {
		    goto overflow;
		}
		length += numBytes;
	    }
	} while (--oc);
    }







|
<
<
<
<
<
<
<
<
<
<
<
|
|
<
<


<
<





>
|
>
>
>
>







2961
2962
2963
2964
2965
2966
2967
2968











2969
2970


2971
2972


2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990

		last = objc - oc;
		first = last;
		pendingPtr = objPtr;
	    } else {

		Tcl_GetStringFromObj(objPtr, &numBytes); /* PANIC? */
		if (numBytes) {











		    last = objc - oc;
		} else if (pendingPtr == NULL || pendingPtr->bytes == NULL) {


		    continue;
		}


		if (pendingPtr) {
		    Tcl_GetStringFromObj(pendingPtr, &length); /* PANIC? */
		    pendingPtr = NULL;
		}
		if (length == 0) {
		    if (numBytes) {
			first = last;
		    } else {
			first = objc - 1;
			last = 0;
		    }
		} else if (numBytes > INT_MAX - length) {
		    goto overflow;
		}
		length += numBytes;
	    }
	} while (--oc);
    }