diff options
author | dgp <dgp@users.sourceforge.net> | 2011-05-05 18:00:54 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2011-05-05 18:00:54 (GMT) |
commit | 1c3bd77ba717f05686929f65fc2ed8087f71f279 (patch) | |
tree | 217346672da82e9fd0cddb3cab78028bed8e004c | |
parent | 1fd1d39eedb4da8fa200dfa4e16c7e4da62ed81d (diff) | |
download | tcl-1c3bd77ba717f05686929f65fc2ed8087f71f279.zip tcl-1c3bd77ba717f05686929f65fc2ed8087f71f279.tar.gz tcl-1c3bd77ba717f05686929f65fc2ed8087f71f279.tar.bz2 |
Disable all the special case code in place to prevent allocation of a List
struct for empty lists as much as possible. The value of this avoidance is
not clear to me. Hoping it can be demonstrated (or refuted) with both variants
side by side in the code history tree.
-rw-r--r-- | generic/tclListObj.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c index c4061b3..b525260 100644 --- a/generic/tclListObj.c +++ b/generic/tclListObj.c @@ -461,7 +461,7 @@ Tcl_ListObjGetElements( if (listPtr->typePtr != &tclListType) { int result, length; - +#if 0 /* * Don't get the string version of a dictionary; that transformation * is not lossy, but is expensive. @@ -477,7 +477,7 @@ Tcl_ListObjGetElements( *objvPtr = NULL; return TCL_OK; } - +#endif result = SetListFromAny(interp, listPtr); if (result != TCL_OK) { return result; @@ -588,7 +588,7 @@ Tcl_ListObjAppendElement( } if (listPtr->typePtr != &tclListType) { int result, length; - +#if 0 if (listPtr->typePtr == &tclDictType) { (void) Tcl_DictObjSize(NULL, listPtr, &length); } else { @@ -598,7 +598,7 @@ Tcl_ListObjAppendElement( Tcl_SetListObj(listPtr, 1, &objPtr); return TCL_OK; } - +#endif result = SetListFromAny(interp, listPtr); if (result != TCL_OK) { return result; @@ -703,7 +703,7 @@ Tcl_ListObjIndex( if (listPtr->typePtr != &tclListType) { int result, length; - +#if 0 if (listPtr->typePtr == &tclDictType) { (void) Tcl_DictObjSize(NULL, listPtr, &length); } else { @@ -713,7 +713,7 @@ Tcl_ListObjIndex( *objPtrPtr = NULL; return TCL_OK; } - +#endif result = SetListFromAny(interp, listPtr); if (result != TCL_OK) { return result; @@ -762,7 +762,7 @@ Tcl_ListObjLength( if (listPtr->typePtr != &tclListType) { int result, length; - +#if 0 if (listPtr->typePtr == &tclDictType) { (void) Tcl_DictObjSize(NULL, listPtr, &length); /* @@ -781,7 +781,7 @@ Tcl_ListObjLength( *intPtr = 0; return TCL_OK; } - +#endif result = SetListFromAny(interp, listPtr); if (result != TCL_OK) { return result; @@ -850,7 +850,7 @@ Tcl_ListObjReplace( } if (listPtr->typePtr != &tclListType) { int length; - +#if 0 if (listPtr->typePtr == &tclDictType) { (void) Tcl_DictObjSize(NULL, listPtr, &length); } else { @@ -863,12 +863,15 @@ Tcl_ListObjReplace( return TCL_OK; } } else { +#endif int result = SetListFromAny(interp, listPtr); if (result != TCL_OK) { return result; } +#if 0 } +#endif } /* @@ -1552,7 +1555,7 @@ TclListObjSetElement( } if (listPtr->typePtr != &tclListType) { int length, result; - +#if 0 if (listPtr->typePtr == &tclDictType) { (void) Tcl_DictObjSize(NULL, listPtr, &length); } else { @@ -1565,6 +1568,7 @@ TclListObjSetElement( } return TCL_ERROR; } +#endif result = SetListFromAny(interp, listPtr); if (result != TCL_OK) { return result; |