diff options
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r-- | generic/tclStringObj.c | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 5793f65..8b6b719 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -1,24 +1,24 @@ /* * tclStringObj.c -- * - * This file contains functions that implement string operations on Tcl - * objects. Some string operations work with UTF-8 encoding forms. - * Functions that require knowledge of the width of each character, - * such as indexing, operate on fixed width encoding forms such as UTF-32. + * This file contains functions that implement string operations on Tcl + * objects. Some string operations work with UTF-8 encoding forms. + * Functions that require knowledge of the width of each character, + * such as indexing, operate on fixed width encoding forms such as UTF-32. * - * Conceptually, a string is a sequence of Unicode code points. Internally - * it may be stored in an encoding form such as a modified version of - * UTF-8 or UTF-32. + * Conceptually, a string is a sequence of Unicode code points. Internally + * it may be stored in an encoding form such as a modified version of + * UTF-8 or UTF-32. * * The String object is optimized for the case where each UTF char * in a string is only one byte. In this case, we store the value of * numChars, but we don't store the fixed form encoding (unless - * Tcl_GetUnicode is explicitly called). + * Tcl_GetUnicode is explicitly called). * - * The String object type stores one or both formats. The default - * behavior is to store UTF-8. Once UTF-16/UTF32 is calculated, it is - * stored in the internal rep for future access (without an additional - * O(n) cost). + * The String object type stores one or both formats. The default + * behavior is to store UTF-8. Once UTF-16/UTF32 is calculated, it is + * stored in the internal rep for future access (without an additional + * O(n) cost). * * To allow many appends to be done to an object without constantly * reallocating space, we allocate double the space and use the @@ -1322,7 +1322,7 @@ Tcl_AppendUnicodeToObj( const Tcl_UniChar *unicode, /* The Unicode string to append to the * object. */ Tcl_Size length) /* Number of chars in Unicode. Negative - * lengths means nul terminated */ + * lengths means nul terminated */ { String *stringPtr; @@ -2161,7 +2161,7 @@ Tcl_AppendFormatToObj( goto error; } if ((unsigned)code > 0x10FFFF) { - code = 0xFFFD; + code = 0xFFFD; } length = Tcl_UniCharToUtf(code, buf); segment = Tcl_NewStringObj(buf, length); @@ -2989,11 +2989,11 @@ TclGetStringStorage( * Performs the [string repeat] function. * * Results: - * A (Tcl_Obj *) pointing to the result value, or NULL in case of an - * error. + * A (Tcl_Obj *) pointing to the result value, or NULL in case of an + * error. * * Side effects: - * On error, when interp is not NULL, error information is left in it. + * On error, when interp is not NULL, error information is left in it. * *--------------------------------------------------------------------------- */ @@ -3016,8 +3016,8 @@ TclStringRepeat( /* * Analyze to determine what representation result should be. * GOALS: Avoid shimmering & string rep generation. - * Produce pure bytearray when possible. - * Error on overflow. + * Produce pure bytearray when possible. + * Error on overflow. */ if (!binary) { @@ -3144,11 +3144,11 @@ TclStringRepeat( * Performs the [string cat] function. * * Results: - * A (Tcl_Obj *) pointing to the result value, or NULL in case of an - * error. + * A (Tcl_Obj *) pointing to the result value, or NULL in case of an + * error. * * Side effects: - * On error, when interp is not NULL, error information is left in it. + * On error, when interp is not NULL, error information is left in it. * *--------------------------------------------------------------------------- */ @@ -3182,8 +3182,8 @@ TclStringCat( /* * Analyze to determine what representation result should be. * GOALS: Avoid shimmering & string rep generation. - * Produce pure bytearray when possible. - * Error on overflow. + * Produce pure bytearray when possible. + * Error on overflow. */ ov = objv, oc = objc; @@ -3200,10 +3200,10 @@ TclStringCat( * create a pure bytearray. */ - binary = 0; - if (ov > objv+1 && ISCONTINUATION(TclGetString(objPtr))) { - forceUniChar = 1; - } else if ((objPtr->typePtr) && TclHasInternalRep(objPtr, &tclStringType)) { + binary = 0; + if (ov > objv+1 && ISCONTINUATION(TclGetString(objPtr))) { + forceUniChar = 1; + } else if ((objPtr->typePtr) && TclHasInternalRep(objPtr, &tclStringType)) { /* Prevent shimmer of non-string types. */ allowUniChar = 0; } @@ -3302,11 +3302,11 @@ TclStringCat( } while (--oc && (length == 0) && (pendingPtr == NULL)); /* - * Either we found a possibly non-empty value, and we remember - * this index as the first and last such value so far seen, + * Either we found a possibly non-empty value, and we remember + * this index as the first and last such value so far seen, * or (oc == 0) and all values are known empty, - * so first = last = objc - 1 signals the right quick return. - */ + * so first = last = objc - 1 signals the right quick return. + */ first = last = objc - oc - 1; @@ -3417,7 +3417,7 @@ TclStringCat( if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "concatenation failed: unable to alloc %" + "concatenation failed: unable to alloc %" TCL_Z_MODIFIER "u bytes", STRING_SIZE(length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", (char *)NULL); @@ -3434,7 +3434,7 @@ TclStringCat( Tcl_DecrRefCount(objResultPtr); if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "concatenation failed: unable to alloc %" + "concatenation failed: unable to alloc %" TCL_Z_MODIFIER "u bytes", STRING_SIZE(length))); Tcl_SetErrorCode(interp, "TCL", "MEMORY", (char *)NULL); @@ -3466,7 +3466,7 @@ TclStringCat( if (0 == Tcl_AttemptSetObjLength(objResultPtr, length)) { if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "concatenation failed: unable to alloc %" TCL_SIZE_MODIFIER "d bytes", + "concatenation failed: unable to alloc %" TCL_SIZE_MODIFIER "d bytes", length)); Tcl_SetErrorCode(interp, "TCL", "MEMORY", (char *)NULL); } @@ -3481,7 +3481,7 @@ TclStringCat( Tcl_DecrRefCount(objResultPtr); if (interp) { Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "concatenation failed: unable to alloc %" TCL_SIZE_MODIFIER "d bytes", + "concatenation failed: unable to alloc %" TCL_SIZE_MODIFIER "d bytes", length)); Tcl_SetErrorCode(interp, "TCL", "MEMORY", (char *)NULL); } @@ -3957,10 +3957,10 @@ TclStringLast( if (ln == 0) { /* - * We don't find empty substrings. Bizarre! + * We don't find empty substrings. Bizarre! * - * TODO: When we one day make this a true substring - * finder, change this to "return last", after limitation. + * TODO: When we one day make this a true substring + * finder, change this to "return last", after limitation. */ goto lastEnd; } |