summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2024-01-29 15:42:30 (GMT)
committersebres <sebres@users.sourceforge.net>2024-01-29 15:42:30 (GMT)
commit8c2649948f8dbe733237e41c8f89e0db8e36b207 (patch)
tree8a4617d75cd60b098e2606b33bc091310dcd3c5f /generic/tclStringObj.c
parentfe55a916019075639e88e4682091c39a2f0abdcb (diff)
parent494c117a0184ec3576a60a26e3425c2f89bea499 (diff)
downloadtcl-8c2649948f8dbe733237e41c8f89e0db8e36b207.zip
tcl-8c2649948f8dbe733237e41c8f89e0db8e36b207.tar.gz
tcl-8c2649948f8dbe733237e41c8f89e0db8e36b207.tar.bz2
merge 8.7
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 0ab5c3a..2268772 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -1640,7 +1640,7 @@ AppendUnicodeToUtfRep(
* None.
*
* Side effects:
- * objPtr's internal rep is reallocated.
+ * objPtr's internal rep is reallocated and string rep is cleaned.
*
*----------------------------------------------------------------------
*/
@@ -1676,7 +1676,7 @@ AppendUtfToUnicodeRep(
* None.
*
* Side effects:
- * objPtr's internal rep is reallocated.
+ * objPtr's string rep is reallocated (by TCL STRING GROWTH ALGORITHM).
*
*----------------------------------------------------------------------
*/
@@ -1756,6 +1756,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). */
+ Tcl_Size 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_AppendStringsToObj --
*
* This function appends one or more null-terminated strings to an