summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2024-01-29 15:26:48 (GMT)
committersebres <sebres@users.sourceforge.net>2024-01-29 15:26:48 (GMT)
commitba6c1f99779d4cb54edb10aeb0d559ea18b4c1c6 (patch)
tree8f85bf18f3421579c02f60799d1835d4364d5e37 /generic/tclStringObj.c
parentc41dda6a3787df275cb5360d6aad18abce39c630 (diff)
parent6d5e3297cb73a8ebe1c913da584efc1bee9d6e04 (diff)
downloadtcl-ba6c1f99779d4cb54edb10aeb0d559ea18b4c1c6.zip
tcl-ba6c1f99779d4cb54edb10aeb0d559ea18b4c1c6.tar.gz
tcl-ba6c1f99779d4cb54edb10aeb0d559ea18b4c1c6.tar.bz2
merge 8.6
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 3afee99..bc2d4e9 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -1963,7 +1963,7 @@ AppendUnicodeToUtfRep(
* None.
*
* Side effects:
- * objPtr's internal rep is reallocated.
+ * objPtr's internal rep is reallocated and string rep is cleaned.
*
*----------------------------------------------------------------------
*/
@@ -1999,7 +1999,7 @@ AppendUtfToUnicodeRep(
* None.
*
* Side effects:
- * objPtr's internal rep is reallocated.
+ * objPtr's string rep is reallocated (by TCL STRING GROWTH ALGORITHM).
*
*----------------------------------------------------------------------
*/
@@ -2079,6 +2079,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_AppendStringsToObjVA --
*
* This function appends one or more null-terminated strings to an