| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
* generic/tclInt.h (TclAppendBytesToByteArray): placing overflow
protection responsibility on caller. Convert "len" argument to signed
int which any value already vetted for overflow issues will fit into.
* generic/tclStringObj.c: Update caller; standardize panic msg.
* generic/tclBinary.c (UpdateStringOfByteArray): Add panic
when the generated string representation would grow beyond Tcl's
size limits. [Bug 2994924]
|
|
|
|
|
|
| |
* generic/tclStringObj.c (Tcl_AppendObjToObj): an append of a byte
array to another into an efficent operation. The problem was the (lack
of) a proper growth management strategy for the byte array.
|
|
|
|
| |
caught by valgrind testing.
|
|
|
|
|
|
|
|
| |
* use do { ... } while (0) in macros
* avoid shadowing one local variable with another
* use clearer 'foo.bar++;' instead of '++foo.bar;' where result not
required (i.e., semantically equivalent)
* follow Engineering Manual rules on spacing and declarations
|
| |
|
|
|
|
| |
one without a very large system, but the leak path existed)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* generic/tclExecute.c: that they set the typePtr field to
* generic/tclIO.c: NULL so that the Tcl_Obj is not left
* generic/tclIndexObj.c: in an inconsistent state.
* generic/tclInt.h: [Bug 2857044]
* generic/tclListObj.c:
* generic/tclNamesp.c:
* generic/tclOOCall.c:
* generic/tclObj.c:
* generic/tclPathObj.c:
* generic/tclProc.c:
* generic/tclRegexp.c:
* generic/tclStringObj.c:
|
|
|
|
| |
[format]. [Bug 2845535]
|
|
|
|
|
| |
* tests/format.test: when format spec request large width
floating point values. Thanks to Clemens Misch. [Bug 2830354]
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
integer calculations computing the length of the %ll formats of
really big integers. Also added protections so that [format]s that
would produce results overflowing the maximum string length of Tcl
values throw a normal Tcl error instead of a panic. [Bug 2801413]
|
|
|
|
|
| |
"pure unicode" representation of an empty string. Thanks to Julian
Noble for reporting the problem. [Bug 2803109]
|
|
|
|
| |
TCL_GROWTH_MIN_ALLOC is everywhere expressed in bytes as comment claims.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
patterns between Unicode and UTF string reps. Most notably the
call: objPtr = Tcl_NewUnicodeObj(...,0); followed by a loop of calls:
Tcl_AppendUnicodeToObj(objPtr, u, n); will now grow and append to
the Unicode representation. Before this commit, the sequence would
convert each append to UTF and perform the append to the UTF rep.
This is puzzling and likely a bug. The performance of [string map]
is significantly improved by this change (according to the MAP
collection of benchmarks in tclbench). Just in case there was some
wisdom in the old ways that I missed, I left in the ability to restore
the old patterns with a #define COMPAT 1 at the top of the file.
|
| |
|
| |
|
|
|
|
| |
Tcl_*SetObjLength() routines.
|
| |
|
|
|
|
|
|
|
|
| |
has parallel structure with GrowUnicodeBuffer(). The revision permits
allocation attempts to continue all the way up to failure, with no gap.
It also directly manipulates the String and Tcl_Obj internals instead
of inefficiently operating via Tcl_*SetObjLength() with all of its
extra protections and underdocumented special cases.
|
|
|
|
| |
the allocation macros.
|
|
|
|
| |
the allocation macros.
|
|
|
|
|
|
|
|
| |
array in a non-extended String struct to one Tcl_UniChar, meant to
hold the terminating NUL character. Non-empty unicode strings are
then stored by extending the String struct by stringPtr->maxChars
additional slots in that array with sizeof(Tcl_UniChar) bytes per slot.
This revision makes the allocation macros much simpler.
|
|
|
|
| |
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.
|
| |
|