summaryrefslogtreecommitdiffstats
path: root/generic/tclUtil.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix Tcl_UtfPrev for TCL_UTF_MAX>3, so it can jump back over Emoji. ↵jan.nijtmans2021-02-161-4/+4
| | | | | Backported from 8.7, no change for TCL_UTF_MAX=3. This way, the previous fix can be slightly more simplified, and working for TCL_UTF_MAX>3 too.
* Fix [d43f96c1a8]: string trimright is broken for Emojijan.nijtmans2021-02-151-8/+9
|
* More usage of TclNewObj() in stead of Tcl_NewObj() and TclNewIntObj() in ↵jan.nijtmans2020-10-131-1/+1
| | | | stead of Tcl_NewIntObj()
* Use "Global" in stead of "Master" internally, where "Master" is not used in ↵jan.nijtmans2020-07-201-2/+2
| | | | the Master-Slave paradigm and where this makes sense.
* In some places, Tcl_UtfPrev()/Tcl_UtfNext() is used traversing the ↵jan.nijtmans2020-05-141-4/+5
| | | | | | individual bytes of a string searching for '(', ')', '::' or other single bytes. It is overkill to use Tcl_UtfPrev/Tcl_UtfNext for that, since those characters can only appear as their ASCII byte, not as any other sequence. This effectively removes the last Tcl_UtfNext() call from the core, the only ones left are in tclTest.c for test commands. So the TclUtfNext() macro doesn't make sense any more. Remove "register" keyword from many files.
* More usage of TclUtfToUCS4(), so we can use the whole Unicode range better ↵jan.nijtmans2020-05-051-22/+22
| | | | in TCL_UTF_MAX>3 builds.
* Code cleanup (more typecasts), making it more compatible with -Wc++-compat. ↵jan.nijtmans2020-04-201-31/+30
| | | | Less use of /* ARGUSED */.
* Merge 8.5. Failing tests for now. To be remedied shortly.dgp2020-04-161-2/+2
|\
| * merge 8.5dgp2020-04-161-1/+1
| |\
| | * Create and use macro TclUtfPrev for Tcl_UtfPrev.dgp2020-04-161-1/+1
| | |
| * | Create and use an optimized macro TclUtfNext() for Tcl_UtfNext().dgp2020-04-141-1/+1
| |/
* | TclTrimRight/TclTrimLeft: removed mixed declarations and code (forbidden in ↵sebres2020-04-151-3/+4
| | | | | | | | | | ISO C90, declaration-after-statement); restored mistakenly removed part of check-in [578c25b43a] (move Tcl_UniChar initializations out of the loop), but "ch2" belongs to the inner loop, so move it inside outer interation.
* | Merge 8.5. Failing tests highlight ticket [1b1f5f0b53].dgp2020-04-131-232/+181
|\ \ | |/
| * [a7f685a181] Eliminate botched call of Tcl_UtfPrev.dgp2020-04-131-3/+5
| |
| * TclTrim() can also demand NUL-terminated arguments, and be simplified.dgp2020-04-131-64/+21
| |
| * TclTrimLeft and TclTrimRight are internal routines. They demand NUL-terminateddgp2020-04-131-69/+25
| | | | | | | | arguments. That's a reasonable burden to put on internal callers, and all existing callers already meet it.
| * [c61818e4c9] [string trimright] robustly handle backing up over incompletedgp2020-04-131-2/+9
| | | | | | or malformed byte sequences.
| * Cherrypick partial fix.dgp2020-04-131-5/+4
| |
| * [085913c760] Fix Tcl_DStringAppendElement quoting of #.dgp2020-04-091-12/+32
| |
| * Guarantee TclNeedSpace and TclFindElement have common definition of whitespacedgp2020-04-091-70/+50
| | | | | | | | by having both call the same routine. Create a macro form to contain performance costs and adapt callers.
| * [afa4b28153] Correct TclNeedSpace handling of trailing escaped space.dgp2020-04-091-8/+36
| |
* | More uppercase HEX representations in source-code.jan.nijtmans2020-03-181-4/+4
| |
* | Minor optimization in TclFormatInt: No need to check for "0" as special ↵jan.nijtmans2019-12-221-18/+5
| | | | | | | | value. No need to include final NULL-byte in character-reversion operation, as we already known the NULL-byte will come last.
* | Merge 8.5jan.nijtmans2019-12-191-1/+1
|\ \ | |/
| * Add type-cast, making sure that the unary minus is handled correctly on any ↵jan.nijtmans2019-12-191-1/+1
| | | | | | | | compiler
* | Merge 8.5jan.nijtmans2019-12-191-15/+4
|\ \ | |/
| * Better fix for [3390638]: making the intVal variable unsigned prevents the ↵jan.nijtmans2019-12-161-15/+4
| | | | | | | | need for using sprintf() altogether.
* | If TCL_UTF_MAX>=4, make Tcl_ParseBackslash combine two surrogates so they ↵jan.nijtmans2019-12-021-1/+1
| | | | | | | | appear as one 4-byte UTF-8 byte sequence from the start. Add test-case for this.
* | More code cleanup: Move more Tcl_UniChar initializations out of the loop. ↵jan.nijtmans2019-09-121-27/+24
| | | | | | | | Remove unnecessary type-casts
* | Code cleanup: Add some initialization to "Tcl_UniChar ch" declaration, ↵jan.nijtmans2019-09-121-8/+8
| | | | | | | | | | making the chance higher that 4-byte UTF-8 sequences are handled more reasonable internally (see: [https://core.tcl-lang.org/tk/tktview?name=a179564826|a179564826]). Use more TclGetString() in stead of Tcl_GetString(), which is slightly more efficient.
* | end-of-line spacingjan.nijtmans2019-05-241-10/+10
|\ \ | |/
* | Backport [bd94500678e837d7] from 8.7, preventing endless loops in UTF-8 ↵jan.nijtmans2019-03-021-1/+1
| | | | | | | | conversions when handling surrogates. Only effective when compiling with -DTCL_UTF_MAX=4|6 (default: 3). Meant for benefit of Androwish.
* | merge 8.5dgp2018-11-091-0/+17
|\ \ | |/
| * Revise bug fix to support (length == 0) correctly.dgp2018-11-091-4/+17
| | | | | | Added comments and improved safety in caller.
| * closes [35a8f1c04a]: minimalist fix - beware of discrepancy between ↵sebres2018-11-091-0/+4
| | | | | | | | TclScanElement and TclConvertElement (prefer braces considering TCL_DONT_QUOTE_HASH in case of first list element)
* | merge 8.5sebres2018-03-141-3/+3
|\ \ | |/
| * TclTrim: special case for TrimRight on single char result of TrimLeft (this ↵sebres2018-03-141-3/+3
| | | | | | | | char is already verified within TrimLeft, so bypass TrimRight at all)
| |
| \
*-. \ merge 8.5dgp2018-03-141-72/+183
|\ \ \ | | |/
| | * TclTrim must write to *trimRight even when making a quick exit.dgp2018-03-141-0/+1
| |/
| * A few minor revisions.dgp2018-03-131-11/+16
| |
| * remove unexpected panic by TclTrimLeft/TclTrimRight, handling rewritten:sebres2018-03-131-55/+173
| | | | | | | | | | | | | | - instead of check the NTS-byte after string (may cause segfault by access violation if out of range), it checks now the end-character is well-formed utf8-sequence; - both work well now on non-NTS strings (without null character at end); - additionally fixed wrong offsets (trim-length if last char malformed in case of out of range); new function TclTrim introduced (as combination of TclTrimLeft/TclTrimRight).
* | Remove unused argument.dgp2018-03-101-6/+5
| |
* | Return routine to file scope.dgp2018-03-091-5/+7
| |
* | Refactor the index value encode/decode machinery for broader use.dgp2018-03-091-0/+137
| | | | | | Make use of it to fix index value flaws in [lsearch].
* | New internal routine TclGetEndOffsetFromObj.dgp2018-03-061-7/+39
| |
* | [8e6a9ac221] Stop false matching with bytearrays. (string-11.55)dgp2018-02-231-1/+2
|\ \ | |/
| * [8e6a9ac221] Stop false matching with bytearrays. (string-11.55)dgp2018-02-231-1/+2
| |
* | Rewrite documentation in comments for brevity and clarity.pooryorick2018-02-141-16/+21
| |
* | Change signature of (internal) TclScanElement() function. This saves memory ↵jan.nijtmans2017-11-151-21/+6
| | | | | | | | allocation and the possibility for panic's in dict and list handling, requiring 1/4 of memory for internal allocation of temporary storage. No change to external API.
* | Better UTF-8 surrogate handling, only functional when TCL_UTF_MAX>3jan.nijtmans2017-06-081-1/+1
| |