summaryrefslogtreecommitdiffstats
path: root/generic/tclUtil.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-07-04 07:09:40 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-07-04 07:09:40 (GMT)
commit9dee089fa2567d307056363c20eb69c53b4e1655 (patch)
treef601a0cf95af6e9aeea8f330063f37565515f418 /generic/tclUtil.c
parent6de91b6b7d469c5f8d511700b75689df23e43fd1 (diff)
parentd3104ac52bdca1849c62445954323c841fcd5009 (diff)
downloadtcl-9dee089fa2567d307056363c20eb69c53b4e1655.zip
tcl-9dee089fa2567d307056363c20eb69c53b4e1655.tar.gz
tcl-9dee089fa2567d307056363c20eb69c53b4e1655.tar.bz2
merge trunk
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r--generic/tclUtil.c37
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, "}");
}
/*