summaryrefslogtreecommitdiffstats
path: root/generic/tclStringObj.c
Commit message (Collapse)AuthorAgeFilesLines
...
* | | * generic/tclStringObj.c: Removed limitation indgp2009-02-151-12/+7
| | | | | | | | | | | | | | | | | | | | | | | | Tcl_AppendObjToObj where the char length of the result was only computed if the appended string was all single byte characters. This limitation was in place to dodge a bug in Tcl_GetUniChar. With that bug gone, we can take advantage of always recording the length of append results when we know it.
* | | * generic/tclStringObj.c: Revisions so that we avoid creatingdgp2009-02-141-51/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the strange representation of an empty string with objPtr->bytes == NULL and stringPtr->hasUnicode == 0. Instead in the situations where that was being created, create a traditional two-legged stork representation (objPtr->bytes = tclEmptyStringRep and stringPtr->hasUnicode = 1). In the situations where the strange rep was treated differently, continue to do so by testing stringPtr->numChars == 0 to detect it. These changes make the code more conventional so easier for new maintainers to pick up. Also sets up further simplifications.
* | | Remove all "register" keywords.dgp2009-02-131-20/+20
| | |
* | | New utility routine UnicodeLength(), to compute the length of unicodedgp2009-02-131-23/+21
| | | | | | | | | | | | | | | buffer arguments when no length is passed in, with built-in overflow protection included. Update three callers to use it.
* | | * generic/tclStringObj.c: Rewrites of the routinesdgp2009-02-131-152/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tcl_GetCharLength, Tcl_GetUniChar, Tcl_GetUnicodeFromObj, Tcl_GetRange, and TclStringObjReverse to use the new macro, and to more simply and clearly split the cases depending on whether a valid unicode rep is present or needs to be created. * generic/tclInt.h: New macro TclNumUtfChars meant to be a faster replacement for a full Tcl_NumUtfChars() call when the string has all single-byte characters.
* | | * generic/tclStringObj.c: Simplified Tcl_GetCharLength bydgp2009-02-121-24/+25
| | | | | | | | | | | | | | | | | | * generic/tclTestObj.c: removing code that did nothing. Added early returns from Tcl_*SetObjLength when the desired length is already present; adapted test command to the change.
* | | * generic/tclStringObj.c: Re-implemented AppendUtfToUnicodeRepdgp2009-02-121-32/+49
| | | | | | | | | | | | | | | | | | so that we no longer pass through Tcl_DStrings which have their own sets of problems when lengths overflow the int range. Now AUTUR and FillUnicodeRep share a common core routine.
* | | Revise latest commit to better maintain stringPtr->numChars.dgp2009-02-121-8/+12
| | |
* | | * generic/tclStringObj.c: Re-implemented AppendUnicodeToUtfRepdgp2009-02-121-54/+79
| | | | | | | | | | | | | | | | | | so that we no longer pass through Tcl_DStrings which have their own sets of problems when lengths overflow the int range. Now AUTUR and UpdateStringOfString share a common core routine.
* | | Removed casts now unnecessary after type of stringPtr->allocated changed.dgp2009-02-111-5/+5
| | |
* | | * generic/tclStringObj.c: Changed type of the 'allocated' fielddgp2009-02-111-2/+2
| | | | | | | | | | | | | | | of the String struct from size_t to int since only int values are ever stored in it.
* | | - eliminate some unnessary type castsnijtmans2009-02-101-3/+3
| | | | | | | | | | | | | | | - some internal const decorations - spacing
* | | Removed handling of (objPtr->bytes != NULL) from UpdateStringOfString,dgp2009-02-101-3/+1
| | | | | | | | | | | | which is only called when objPtr->bytes is NULL.
* | | Simplify Tcl_SetObjLength by removing unreachable code.dgp2009-02-101-10/+3
| | |
* | | Simplify SetStringFromAny() by removing unreachable and duplicate code.dgp2009-02-101-25/+13
| | |
* | | * generic/tclObj.c (Tcl_GetString): Added comments and validitydgp2009-02-101-11/+4
| | | | | | | | | | | | | | | | | | checks following the call to an UpdateStringProc. Simplify Tcl_AttemptSetObjLength by removing unreachable code.
* | | Convert all Tcl_InvalidateStringRep() calls into macros.dgp2009-02-101-7/+7
| | |
* | | * generic/tclStringObj.c: Reduce code duplication in Tcl_GetUnicode*.dgp2009-02-101-5/+3
| | | | | | | | | | | | Restrict AppendUtfToUtfRep to non-negative length appends.
* | | * generic/tclStringObj.c (Tcl_GetUnicode*): Reduce code duplication.dgp2009-02-101-25/+2
| | |
* | | Add missing castdkf2009-02-051-2/+2
| | |
* | | More/better/cleaner handling of the bytearray special casing for string ops.dkf2009-02-051-14/+82
| | |
* | | Improve efficiency of Tcl_AppendObjToObj's bytearray handling.dkf2009-02-051-1/+30
| | |
* | | comment typodgp2009-02-041-2/+2
| | |
* | | * generic/tclStringObj.c: Added overflow protections to thedgp2009-02-041-4/+14
| | | | | | | | | | | | | | | AppendUtfToUtfRep routine to either avoid invalid arguments and crashes, or to replace them with controlled panics. [Bug 2561794]
* | | * generic/tclStringObj.c (SetUnicodeObj): Corrected failure ofdgp2009-02-031-43/+28
| | | | | | | | | | | | | | | Tcl_SetUnicodeObj() to panic on a shared object. [Bug 2561488]. Also factored out common code to reduce duplication.
* | | * generic/tclStringObj.c (STRING_NOMEM): Add missing cast ofdgp2009-02-021-2/+3
| | | | | | | | | | | | NULL to (char *) that upsets some compilers. [Bug 2494093].
* | | * generic/tclStringObj.c (Tcl_(Attempt)SetObjLength): Addeddgp2009-02-021-1/+16
| | | | | | | | | | | | | | | | | | protections against callers asking for negative lengths. It is likely when this happens that an integer overflow is to blame. [Bug 2553906].
* | | * generic/tclStringObj.c: New fix for [Bug 2494093] replaces thedgp2009-01-211-24/+30
| | | | | | | | | | | | flawed attempt committed 2009-01-09.
* | | * generic/tclStringObj.c (STRING_SIZE): Corrected failure to limitdgp2009-01-091-4/+7
| | | | | | | | | | | | | | | memory allocation requests to the sizes that can be supported by Tcl's memory allocation routines. [Bug 2494093].
* | | * generic/tclStringObj.c (STRING_UALLOC): Added missing parensdgp2009-01-081-2/+2
| | | | | | | | | | | | | | | required to get correct results out of things like STRING_UALLOC(num + append). [Bug 2494093].
* | | move variable "length" inside if()nijtmans2008-12-171-2/+2
| | | | | | | | | | | | | | | don't use ckfree((void *)...) but ckfree((char *)...)
* | | TIP #343 IMPLEMENTATION - A Binary Specifier for [format/scan]ferrieux2008-12-101-5/+12
| | |
* | | Style improvements - invoking callbacks without visual junk.dkf2008-10-261-5/+4
| | |
* | | Add "const" to many internalnijtmans2008-10-161-2/+2
| | | | | | | | | | | | | | | const tables. No functional or API change.
* | | Add "const" to many internalnijtmans2008-10-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | const tables, so those will be put by the C-compiler in the TEXT segment in stead of the DATA segment. This makes those table sharable in shared libraries.
* | | * generic/tclStringObj.c (Tcl_AppendFormatToObj):rmax2008-04-071-3/+3
|/ / | | | | | | | | | | Fix [format {% d}] so that it behaves the same way as in 8.4 and as C's printf(). * tests/format.test: Add a test for '% d' and '%+d'.
* | * generic/tclStringObj.c (Tcl_AppendFormatToObj): [format %llx $big]dgp2008-02-281-1/+4
| | | | | | | | leaked an mp_int.
* | * generic/tclStringObj.c (Tcl_AppendFormatToObj): Correct failure todgp2008-01-101-4/+4
| | | | | | | | | | * tests/format.test: account for big.used == 0 corner case in the %ll(idox) format directives. [Bug 1867855].
* | merge stable branch onto HEADdgp2007-12-131-1/+1
| |
* | More minor cleanupdkf2007-11-181-74/+69
| |
* | [Patch 1830038]: Increased usage of macros to detect and take advantage of ↵Miguel Sofer2007-11-111-17/+17
| | | | | | | | objTypes.
* | * generic/tclCmdMZ.c (STR_REVERSE): Implement the actualdgp2007-03-281-1/+83
| | | | | | | | | | | | | | | | | | | | | | [string reverse] command in terms of the new TclStringObjReverse() routine. * generic/tclInt.h (TclStringObjReverse): New internal routine * generic/tclStringObj.c (TclStringObjReverse): that implements the [string reverse] operation, making use of knowledge/surgery of the String intrep to minimize the number of allocs and copies needed to do the job.
* | * generic/tclExecute.c: More ckalloc -> ckrealloc conversions.dgp2007-03-211-10/+8
| | | | | | | | | | | | | | | | | | * generic/tclLiteral.c: * generic/tclNamesp.c: * generic/tclParse.c: * generic/tclPreserve.c: * generic/tclStringObj.c: * generic/tclUtil.c:
* | TIP#270 IMPLEMENTATIONdgp2006-11-151-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tcl.decls: New public routines Tcl_ObjPrintf, * generic/tclStringObj.c: Tcl_AppendObjToErrorInfo, Tcl_Format, * generic/tclInt.h: Tcl_AppendLimitedToObj, Tcl_AppendFormatToObj and Tcl_AppendPrintfToObj. Former internal versions removed. * generic/tclDecls.h: make genstubs * generic/tclStubInit.c: * generic/tclBasic.c: Updated callers. * generic/tclCkalloc.c: * generic/tclCmdAH.c: * generic/tclCmdIL.c: * generic/tclCmdMZ.c: * generic/tclCompExpr.c: * generic/tclCompile.c: * generic/tclDictObj.c: * generic/tclExecute.c: * generic/tclIORChan.c: * generic/tclIOUtil.c: * generic/tclMain.c: * generic/tclNamesp.c: * generic/tclObj.c: * generic/tclPkg.c: * generic/tclProc.c: * generic/tclStrToD.c: * generic/tclTimer.c: * generic/tclUtil.c: * unix/tclUnixFCmd.c:
* | * generic/tclStringObj.c: Changed Tcl_ObjPrintf() response todgp2006-11-051-2/+3
| | | | | | | | | | an invalid format specifier string. No longer panics; now produces an error message as output.
* | * generic/tclCmdAH.c: Further revisions to produce the routinesdgp2006-11-021-91/+10
| | | | | | | | | | | | * generic/tclInt.h: TclFormat() and TclAppendFormatToObj() that * generic/tclNamesp.c: accept (objc, objv) arguments rather than * generic/tclStringObj.c: any varargs stuff.
* | * generic/tclBasic.c: Further revised TclAppendPrintToObj() anddgp2006-11-021-18/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclCkalloc.c: TclObjPrintf() routines to panic when unable * generic/tclCmdAH.c: to complete their formatting operations, rather * generic/tclCmdIL.c: than report an error message. This means an * generic/tclCmdMZ.c: interp argument for error message recording is * generic/tclDictObj.c: no longer needed, further simplifying the * generic/tclExecute.c: interface for callers. * generic/tclIORChan.c: * generic/tclIOUtil.c: * generic/tclInt.h: * generic/tclMain.c: * generic/tclNamesp.c: * generic/tclParseExpr.c: * generic/tclPkg.c: * generic/tclProc.c: * generic/tclStringObj.c: * generic/tclTimer.c: * generic/tclUtil.c: * unix/tclUnixFCmd.c:
* | * generic/tclBasic.c: Refactored and renamed the routinesdgp2006-10-311-25/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * generic/tclCkalloc.c: TclObjPrintf, TclFormatObj, and * generic/tclCmdAH.c: TclFormatToErrorInfo to a new set of * generic/tclCmdIL.c: routines TclAppendPrintfToObj, * generic/tclCmdMZ.c: TclAppendFormatToObj, TclObjPrintf, and * generic/tclDictObj.c: TclObjFormat, with the intent of making * generic/tclExecute.c: the latter list, plus TclAppendLimitedToObj * generic/tclIORChan.c: and TclAppendObjToErrorInfo, public via * generic/tclIOUtil.c: a revised TIP 270. * generic/tclInt.h: * generic/tclMain.c: * generic/tclNamesp.c: * generic/tclParseExpr.c: * generic/tclPkg.c: * generic/tclProc.c: * generic/tclStringObj.c: * generic/tclTimer.c: * generic/tclUtil.c: * unix/tclUnixFCmd.c:
* | * generic/tclStringObj.c (STRING_SIZE): fix allocation forMiguel Sofer2006-09-241-2/+4
| | | | | | | | 0-length strings. This is coverity's bugs #54-5
* | * generic/tclStringObj.c: Revised ObjPrintfVA to take caredgp2006-08-281-17/+30
| | | | | | | | | | | | | | | | * generic/tclParseExpr.c: to copy only whole characters when doing %s formatting. This relieves callers of TclObjPrintf() and TclFormatToErrorInfo() from needing to fix arguments to character boundaries. Tcl_ParseExpr() simplified by taking advantage. [Bug 1547786]