diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-01-14 19:56:43 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-01-14 19:56:43 (GMT) |
| commit | ea654cca69bc5e2bc539a27b0d7322f20466134f (patch) | |
| tree | 55eda7fdbc9face1592531a010869f1673fa7634 /generic/tclListObj.c | |
| parent | b2d00eb8176d84863a75aa771036a478115dbf57 (diff) | |
| parent | d64b6707b4b91c88d56b0147c0237411f47caa39 (diff) | |
| download | tcl-ea654cca69bc5e2bc539a27b0d7322f20466134f.zip tcl-ea654cca69bc5e2bc539a27b0d7322f20466134f.tar.gz tcl-ea654cca69bc5e2bc539a27b0d7322f20466134f.tar.bz2 | |
merge trunk
remove some EXTERN and CONST usages in tclUnixPort.h
Diffstat (limited to 'generic/tclListObj.c')
| -rw-r--r-- | generic/tclListObj.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c index 17aa256..20b6ec1 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -857,6 +857,10 @@ Tcl_ListObjReplace( isShared = (listRepPtr->refCount > 1); numRequired = numElems - count + objc; + for (i = 0; i < objc; i++) { + Tcl_IncrRefCount(objv[i]); + } + if ((numRequired <= listRepPtr->maxElemCount) && !isShared) { int shift; @@ -902,6 +906,14 @@ Tcl_ListObjReplace( listRepPtr = AttemptNewList(interp, newMax, NULL); if (listRepPtr == NULL) { + for (i = 0; i < objc; i++) { + /* See bug 3598580 */ +#if TCL_MAJOR_VERSION > 8 + Tcl_DecrRefCount(objv[i]); +#else + objv[i]->refCount--; +#endif + } return TCL_ERROR; } @@ -964,14 +976,11 @@ Tcl_ListObjReplace( } /* - * Insert the new elements into elemPtrs before "first". We don't do a - * memcpy here because we must increment the reference counts for the - * added elements, so we must explicitly loop anyway. + * Insert the new elements into elemPtrs before "first". */ for (i=0,j=first ; i<objc ; i++,j++) { elemPtrs[j] = objv[i]; - Tcl_IncrRefCount(objv[i]); } /* |
