diff options
author | dgp <dgp@users.sourceforge.net> | 2014-02-06 19:04:36 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-02-06 19:04:36 (GMT) |
commit | 11b2556b272a74d9456a2b0b9cef5ccc76fd8316 (patch) | |
tree | 0200708c41644616f3064cf13f8525b0194b9899 /generic/tclStringObj.c | |
parent | 204a41c65d68c707c0b4e6114424444c59e75808 (diff) | |
download | tcl-11b2556b272a74d9456a2b0b9cef5ccc76fd8316.zip tcl-11b2556b272a74d9456a2b0b9cef5ccc76fd8316.tar.gz tcl-11b2556b272a74d9456a2b0b9cef5ccc76fd8316.tar.bz2 |
Revised ReadChars to restore an attempt to make sure we do not short readdgp_may_be_pointless
because of a false notion of limited storage space.
The test suite does not appear to demonstrate any case where this matters.
Could be an incomplete test suite, or an example of pointless code.
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r-- | generic/tclStringObj.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index d96d814..8c6a376 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -2711,6 +2711,38 @@ Tcl_ObjPrintf( /* *--------------------------------------------------------------------------- * + * TclGetStringStorage -- + * + * Returns the string storage space of a Tcl_Obj. + * + * Results: + * The pointer value objPtr->bytes is returned and the number of bytes + * allocated there is written to *sizePtr (if known). + * + * Side effects: + * May set objPtr->bytes. + * + *--------------------------------------------------------------------------- + */ + +char * +TclGetStringStorage( + Tcl_Obj *objPtr, + unsigned int *sizePtr) +{ + String *stringPtr; + + if (objPtr->typePtr != &tclStringType || objPtr->bytes == NULL) { + return TclGetStringFromObj(objPtr, (int *)sizePtr); + } + + stringPtr = GET_STRING(objPtr); + *sizePtr = stringPtr->allocated; + return objPtr->bytes; +} +/* + *--------------------------------------------------------------------------- + * * TclStringObjReverse -- * * Implements the [string reverse] operation. |