summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r--generic/tclStringObj.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 975b991..7f9f874 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -1671,7 +1671,7 @@ AppendUnicodeToUtfRep(
* None.
*
* Side effects:
- * objPtr's internal rep is reallocated.
+ * objPtr's internal rep is reallocated and string rep is cleaned.
*
*----------------------------------------------------------------------
*/
@@ -1707,7 +1707,7 @@ AppendUtfToUnicodeRep(
* None.
*
* Side effects:
- * objPtr's internal rep is reallocated.
+ * objPtr's string rep is reallocated (by TCL STRING GROWTH ALGORITHM).
*
*----------------------------------------------------------------------
*/
@@ -1787,6 +1787,39 @@ AppendUtfToUtfRep(
/*
*----------------------------------------------------------------------
*
+ * TclAppendUtfToUtf --
+ *
+ * This function appends "numBytes" bytes of "bytes" to the UTF string
+ * rep of "objPtr" (objPtr's internal rep converted to string on demand).
+ * numBytes must be non-negative.
+ *
+ * Results:
+ * None.
+ *
+ * Side effects:
+ * objPtr's string rep is reallocated (by TCL STRING GROWTH ALGORITHM).
+ *
+ *----------------------------------------------------------------------
+ */
+
+void
+TclAppendUtfToUtf(
+ Tcl_Obj *objPtr, /* Points to the object to append to. */
+ const char *bytes, /* String to append (or NULL to enlarge buffer). */
+ int numBytes) /* Number of bytes of "bytes" to append. */
+{
+ if (Tcl_IsShared(objPtr)) {
+ Tcl_Panic("%s called with shared object", "TclAppendUtfToUtf");
+ }
+
+ SetStringFromAny(NULL, objPtr);
+
+ AppendUtfToUtfRep(objPtr, bytes, numBytes);
+}
+
+/*
+ *----------------------------------------------------------------------
+ *
* Tcl_AppendStringsToObjVA --
*
* This function appends one or more null-terminated strings to an