summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
diff options
context:
space:
mode:
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r--generic/tclStringObj.c81
1 files changed, 41 insertions, 40 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 815c64f..3063ea3 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -137,7 +137,7 @@ GrowStringBuffer(
int flag)
{
/*
- * Pre-conditions:
+ * Preconditions:
* objPtr->typePtr == &tclStringType
* needed > stringPtr->allocated
* flag || objPtr->bytes != NULL
@@ -185,7 +185,7 @@ GrowUnicodeBuffer(
size_t needed)
{
/*
- * Pre-conditions:
+ * Preconditions:
* objPtr->typePtr == &tclStringType
* needed > stringPtr->maxChars
*/
@@ -390,7 +390,7 @@ Tcl_NewUnicodeObj(
* Get the length of the Unicode string from the Tcl object.
*
* Results:
- * Pointer to unicode string representing the unicode object.
+ * Pointer to Unicode string representing the Unicode object.
*
* Side effects:
* Frees old internal rep. Allocates memory for new "String" internal
@@ -563,7 +563,7 @@ Tcl_GetUniChar(
}
/*
- * Optimize the case where we're really dealing with a bytearray object
+ * Optimize the case where we're really dealing with a ByteArray object
* we don't need to convert to a string to perform the indexing operation.
*/
@@ -635,8 +635,8 @@ TclGetUniChar(
}
/*
- * Optimize the case where we're really dealing with a bytearray object
- * we don't need to convert to a string to perform the indexing operation.
+ * Optimize the ByteArray case: N need need to convert to a string to
+ * perform the indexing operation.
*/
if (TclIsPureByteArray(objPtr)) {
@@ -680,12 +680,13 @@ TclGetUniChar(
*/
#undef Tcl_GetUnicodeFromObj
+#if !defined(TCL_NO_DEPRECATED)
Tcl_UniChar *
TclGetUnicodeFromObj(
- Tcl_Obj *objPtr, /* The object to find the unicode string
+ Tcl_Obj *objPtr, /* The object to find the Unicode string
* for. */
int *lengthPtr) /* If non-NULL, the location where the string
- * rep's unichar length should be stored. If
+ * rep's Tcl_UniChar length should be stored. If
* NULL, no length is stored. */
{
String *stringPtr;
@@ -707,6 +708,7 @@ TclGetUnicodeFromObj(
}
return stringPtr->unicode;
}
+#endif /* !defined(TCL_NO_DEPRECATED) */
Tcl_UniChar *
Tcl_GetUnicodeFromObj(
@@ -945,20 +947,19 @@ Tcl_SetStringObj(
*
* Tcl_SetObjLength --
*
- * This function changes the length of the string representation of an
- * object.
+ * Changes the length of the string representation of objPtr.
*
* Results:
* None.
*
* Side effects:
- * If the size of objPtr's string representation is greater than length,
- * then it is reduced to length and a new terminating null byte is stored
- * in the strength. If the length of the string representation is greater
- * than length, the storage space is reallocated to the given length; a
- * null byte is stored at the end, but other bytes past the end of the
- * original string representation are undefined. The object's internal
- * representation is changed to "expendable string".
+ * If the size of objPtr's string representation is greater than length, a
+ * new terminating null byte is stored in objPtr->bytes at length, and
+ * bytes at positions past length have no meaning. If the length of the
+ * string representation is greater than length, the storage space is
+ * reallocated to length+1.
+ *
+ * The object's internal representation is changed to &tclStringType.
*
*----------------------------------------------------------------------
*/
@@ -1008,7 +1009,7 @@ Tcl_SetObjLength(
objPtr->bytes[length] = 0;
/*
- * Invalidate the unicode data.
+ * Invalidate the Unicode data.
*/
stringPtr->numChars = TCL_INDEX_NONE;
@@ -1021,7 +1022,7 @@ Tcl_SetObjLength(
}
/*
- * Mark the new end of the unicode string
+ * Mark the new end of the Unicode string
*/
stringPtr->numChars = length;
@@ -1110,14 +1111,14 @@ Tcl_AttemptSetObjLength(
objPtr->bytes[length] = 0;
/*
- * Invalidate the unicode data.
+ * Invalidate the Unicode data.
*/
stringPtr->numChars = TCL_INDEX_NONE;
stringPtr->hasUnicode = 0;
} else {
/*
- * Changing length of pure unicode string.
+ * Changing length of pure Unicode string.
*/
if (length > stringPtr->maxChars) {
@@ -1130,7 +1131,7 @@ Tcl_AttemptSetObjLength(
}
/*
- * Mark the new end of the unicode string.
+ * Mark the new end of the Unicode string.
*/
stringPtr->unicode[length] = 0;
@@ -1164,9 +1165,9 @@ Tcl_AttemptSetObjLength(
void
Tcl_SetUnicodeObj(
Tcl_Obj *objPtr, /* The object to set the string of. */
- const Tcl_UniChar *unicode, /* The unicode string used to initialize the
+ const Tcl_UniChar *unicode, /* The Unicode string used to initialize the
* object. */
- Tcl_Size numChars) /* Number of characters in the unicode
+ Tcl_Size numChars) /* Number of characters in the Unicode
* string. */
{
if (Tcl_IsShared(objPtr)) {
@@ -1194,9 +1195,9 @@ UnicodeLength(
static void
SetUnicodeObj(
Tcl_Obj *objPtr, /* The object to set the string of. */
- const Tcl_UniChar *unicode, /* The unicode string used to initialize the
+ const Tcl_UniChar *unicode, /* The Unicode string used to initialize the
* object. */
- Tcl_Size numChars) /* Number of characters in the unicode
+ Tcl_Size numChars) /* Number of characters in the Unicode
* string. */
{
String *stringPtr;
@@ -1369,9 +1370,9 @@ Tcl_AppendToObj(
void
Tcl_AppendUnicodeToObj(
Tcl_Obj *objPtr, /* Points to the object to append to. */
- const Tcl_UniChar *unicode, /* The unicode string to append to the
+ const Tcl_UniChar *unicode, /* The Unicode string to append to the
* object. */
- Tcl_Size length) /* Number of chars in "unicode". Negative
+ Tcl_Size length) /* Number of chars in Unicode. Negative
* lengths means nul terminated */
{
String *stringPtr;
@@ -1440,7 +1441,7 @@ Tcl_AppendObjToObj(
}
/*
- * Handle append of one bytearray object to another as a special case.
+ * Handle append of one ByteArray object to another as a special case.
* Note that we only do this when the objects are pure so that the
* bytearray faithfully represent the true value; Otherwise appending the
* byte arrays together could lose information;
@@ -1557,8 +1558,8 @@ Tcl_AppendObjToObj(
*
* AppendUnicodeToUnicodeRep --
*
- * This function appends the contents of "unicode" to the Unicode rep of
- * "objPtr". objPtr must already have a valid Unicode rep.
+ * Appends the contents of unicode to the Unicode rep of
+ * objPtr, which must already have a valid Unicode rep.
*
* Results:
* None.
@@ -1589,7 +1590,7 @@ AppendUnicodeToUnicodeRep(
stringPtr = GET_STRING(objPtr);
/*
- * If not enough space has been allocated for the unicode rep, reallocate
+ * If not enough space has been allocated for the Unicode rep, reallocate
* the internal rep object with additional space. First try to double the
* required allocation; if that fails, try a more modest increase. See the
* "TCL STRING GROWTH ALGORITHM" comment at the top of this file for an
@@ -1602,7 +1603,7 @@ AppendUnicodeToUnicodeRep(
Tcl_Size offset = -1;
/*
- * Protect against case where unicode points into the existing
+ * Protect against case where Unicode points into the existing
* stringPtr->unicode array. Force it to follow any relocations due to
* the reallocs below.
*/
@@ -1616,7 +1617,7 @@ AppendUnicodeToUnicodeRep(
stringPtr = GET_STRING(objPtr);
/*
- * Relocate unicode if needed; see above.
+ * Relocate Unicode if needed; see above.
*/
if (offset >= 0) {
@@ -1661,7 +1662,7 @@ static void
AppendUnicodeToUtfRep(
Tcl_Obj *objPtr, /* Points to the object to append to. */
const Tcl_UniChar *unicode, /* String to convert to UTF. */
- Tcl_Size numChars) /* Number of chars of "unicode" to convert. */
+ Tcl_Size numChars) /* Number of chars of Unicode to convert. */
{
String *stringPtr = GET_STRING(objPtr);
@@ -3941,8 +3942,8 @@ TclStringReverse(
if (!inPlace || Tcl_IsShared(objPtr)) {
/*
- * Create a non-empty, pure unicode value, so we can coax
- * Tcl_SetObjLength into growing the unicode rep buffer.
+ * Create a non-empty, pure Unicode value, so we can coax
+ * Tcl_SetObjLength into growing the Unicode rep buffer.
*/
objPtr = Tcl_NewUnicodeObj(&ch, 1);
@@ -4350,7 +4351,7 @@ DupStringInternalRep(
*
* Side effects:
* Any old internal representation for objPtr is freed and the internal
- * representation is set to "String".
+ * representation is set to &tclStringType.
*
*----------------------------------------------------------------------
*/
@@ -4397,7 +4398,7 @@ SetStringFromAny(
* None.
*
* Side effects:
- * The object's string may be set by converting its Unicode represention
+ * The object's string may be set by converting its Unicode representation
* to UTF format.
*
*----------------------------------------------------------------------
@@ -4434,7 +4435,7 @@ ExtendStringRepWithUnicode(
Tcl_Size numChars)
{
/*
- * Pre-condition: this is the "string" Tcl_ObjType.
+ * Precondition: this is the "string" Tcl_ObjType.
*/
Tcl_Size i, origLength, size = 0;