diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-07-04 07:09:40 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-07-04 07:09:40 (GMT) |
commit | 9dee089fa2567d307056363c20eb69c53b4e1655 (patch) | |
tree | f601a0cf95af6e9aeea8f330063f37565515f418 /generic/tclUtil.c | |
parent | 6de91b6b7d469c5f8d511700b75689df23e43fd1 (diff) | |
parent | d3104ac52bdca1849c62445954323c841fcd5009 (diff) | |
download | tcl-9dee089fa2567d307056363c20eb69c53b4e1655.zip tcl-9dee089fa2567d307056363c20eb69c53b4e1655.tar.gz tcl-9dee089fa2567d307056363c20eb69c53b4e1655.tar.bz2 |
merge trunk
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r-- | generic/tclUtil.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c index d5a3b94..3379f6c 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -2438,6 +2438,37 @@ Tcl_DStringAppend( /* *---------------------------------------------------------------------- * + * TclDStringAppendObj, TclDStringAppendDString -- + * + * Simple wrappers round Tcl_DStringAppend that make it easier to append + * from particular sources of strings. + * + *---------------------------------------------------------------------- + */ + +char * +TclDStringAppendObj( + Tcl_DString *dsPtr, + Tcl_Obj *objPtr) +{ + int length; + char *bytes = Tcl_GetStringFromObj(objPtr, &length); + + return Tcl_DStringAppend(dsPtr, bytes, length); +} + +char * +TclDStringAppendDString( + Tcl_DString *dsPtr, + Tcl_DString *toAppendPtr) +{ + return Tcl_DStringAppend(dsPtr, Tcl_DStringValue(toAppendPtr), + Tcl_DStringLength(toAppendPtr)); +} + +/* + *---------------------------------------------------------------------- + * * Tcl_DStringAppendElement -- * * Append a list element to the current value of a dynamic string. @@ -2793,9 +2824,9 @@ Tcl_DStringStartSublist( Tcl_DString *dsPtr) /* Dynamic string. */ { if (TclNeedSpace(dsPtr->string, dsPtr->string + dsPtr->length)) { - Tcl_DStringAppend(dsPtr, " {", -1); + TclDStringAppendLiteral(dsPtr, " {"); } else { - Tcl_DStringAppend(dsPtr, "{", -1); + TclDStringAppendLiteral(dsPtr, "{"); } } @@ -2821,7 +2852,7 @@ void Tcl_DStringEndSublist( Tcl_DString *dsPtr) /* Dynamic string. */ { - Tcl_DStringAppend(dsPtr, "}", -1); + TclDStringAppendLiteral(dsPtr, "}"); } /* |