| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | |
| | |
| | |
| | | |
and solve overflow and growth algorithm fallbacks in it.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* generic/tclStringObj.c: Convert Tcl_AppendStringsToObj into
* tests/stringObj.test: a radically simpler implementation
where we just loop over calls to Tcl_AppendToObj. This fixes [Bug
2597185]. It also creates a *** POTENTIAL INCOMPATIBILITY *** in
that T_ASTO can now allocate more space than is strictly required,
like all the other Tcl_Append* routines. The incompatibility was
detected by test stringObj-6.5, which I've updated to reflect the
new behavior.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
in ExtendStringRepWithUnicode. Use cheap checks to determine that
no reallocation is necessary without cost of computing the precise
number of bytes needed. Also make use of the string growth algortihm
in the case of repeated appends.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* generic/tclTestObj.c: accesses when we append (some part of)
* tests/stringObj.test: a Tcl_Obj to itself. Added the
appendself and appendself2 subcommands to the [teststringobj] testing
command and added tests to the test suite. [Bug 2603158]
|
| | |
| | |
| | |
| | | |
Tcl_AppendObjToObj.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
of the String struct, storing the number of bytes allocated to store
the Tcl_UniChar array, with an 'int maxChars' field, storing the
number of Tcl_UniChars that may be stored in the allocated space.
This reduces memory requirement a small bit, and makes some range
checks simpler to code.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
buffer arguments when no length is passed in, with built-in
overflow protection included. Update three callers to use it.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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/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.
|
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
of the String struct from size_t to int since only int values are
ever stored in it.
|
| | |
| | |
| | |
| | |
| | | |
- some internal const decorations
- spacing
|
| | |
| | |
| | |
| | | |
which is only called when objPtr->bytes is NULL.
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | | |
checks following the call to an UpdateStringProc.
Simplify Tcl_AttemptSetObjLength by removing unreachable code.
|
| | | |
|
| | |
| | |
| | |
| | | |
Restrict AppendUtfToUtfRep to non-negative length appends.
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
AppendUtfToUtfRep routine to either avoid invalid arguments and
crashes, or to replace them with controlled panics. [Bug 2561794]
|
| | |
| | |
| | |
| | |
| | | |
Tcl_SetUnicodeObj() to panic on a shared object. [Bug 2561488]. Also
factored out common code to reduce duplication.
|
| | |
| | |
| | |
| | | |
NULL to (char *) that upsets some compilers. [Bug 2494093].
|
| | |
| | |
| | |
| | |
| | |
| | | |
protections against callers asking for negative lengths. It is
likely when this happens that an integer overflow is to blame.
[Bug 2553906].
|
| | |
| | |
| | |
| | | |
flawed attempt committed 2009-01-09.
|
| | |
| | |
| | |
| | |
| | | |
memory allocation requests to the sizes that can be supported by
Tcl's memory allocation routines. [Bug 2494093].
|
| | |
| | |
| | |
| | |
| | | |
required to get correct results out of things like
STRING_UALLOC(num + append). [Bug 2494093].
|
| | |
| | |
| | |
| | |
| | | |
don't use ckfree((void *)...) but
ckfree((char *)...)
|
| | | |
|
| | | |
|
| | |
| | |
| | |
| | |
| | | |
const tables. No functional
or API change.
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
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.
|
|/ /
| |
| |
| |
| |
| | |
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'.
|
| |
| |
| |
| | |
leaked an mp_int.
|
| |
| |
| |
| |
| | |
* tests/format.test: account for big.used == 0 corner case in the
%ll(idox) format directives. [Bug 1867855].
|
| | |
|
| | |
|
| |
| |
| |
| | |
objTypes.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
[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/tclLiteral.c:
* generic/tclNamesp.c:
* generic/tclParse.c:
* generic/tclPreserve.c:
* generic/tclStringObj.c:
* generic/tclUtil.c:
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* 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:
|