summaryrefslogtreecommitdiffstats
path: root/generic/tclRegexp.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-05-31 12:50:04 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-05-31 12:50:04 (GMT)
commit84b9d03fb02b9ee744e03775f590d49f105d23f8 (patch)
tree5744c424eb00548acf667916895305f874909917 /generic/tclRegexp.c
parent2ed71e62a0e1b2fc0b0dca264ffa417ba2d9b159 (diff)
parenta2a03ea8fb6718cc472cc7dcb44f8e68aadb24ba (diff)
downloadtcl-84b9d03fb02b9ee744e03775f590d49f105d23f8.zip
tcl-84b9d03fb02b9ee744e03775f590d49f105d23f8.tar.gz
tcl-84b9d03fb02b9ee744e03775f590d49f105d23f8.tar.bz2
TIP 537 implementation: Enable 64-bit indexes in regexp matching
Diffstat (limited to 'generic/tclRegexp.c')
-rw-r--r--generic/tclRegexp.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c
index 67195bb..5df76c3 100644
--- a/generic/tclRegexp.c
+++ b/generic/tclRegexp.c
@@ -264,7 +264,7 @@ Tcl_RegExpRange(
if (index > regexpPtr->re.re_nsub) {
*startPtr = *endPtr = NULL;
- } else if (regexpPtr->matches[index].rm_so == -1) {
+ } else if (regexpPtr->matches[index].rm_so == (size_t)-1) {
*startPtr = *endPtr = NULL;
} else {
if (regexpPtr->objPtr) {
@@ -363,21 +363,21 @@ TclRegExpRangeUniChar(
* passed to Tcl_RegExpExec. */
size_t index, /* 0 means give the range of the entire match,
* > 0 means give the range of a matching
- * subrange, -1 means the range of the
+ * subrange, TCL_INDEX_NONE means the range of the
* rm_extend field. */
- int *startPtr, /* Store address of first character in
+ size_t *startPtr, /* Store address of first character in
* (sub-)range here. */
- int *endPtr) /* Store address of character just after last
+ size_t *endPtr) /* Store address of character just after last
* in (sub-)range here. */
{
TclRegexp *regexpPtr = (TclRegexp *) re;
- if ((regexpPtr->flags&REG_EXPECT) && index == TCL_AUTO_LENGTH) {
+ if ((regexpPtr->flags&REG_EXPECT) && (index == TCL_INDEX_NONE)) {
*startPtr = regexpPtr->details.rm_extend.rm_so;
*endPtr = regexpPtr->details.rm_extend.rm_eo;
- } else if (index > regexpPtr->re.re_nsub) {
- *startPtr = -1;
- *endPtr = -1;
+ } else if (index + 1 > regexpPtr->re.re_nsub + 1) {
+ *startPtr = TCL_INDEX_NONE;
+ *endPtr = TCL_INDEX_NONE;
} else {
*startPtr = regexpPtr->matches[index].rm_so;
*endPtr = regexpPtr->matches[index].rm_eo;
@@ -677,7 +677,7 @@ TclRegAbout(
resultObj = Tcl_NewObj();
Tcl_ListObjAppendElement(NULL, resultObj,
- Tcl_NewWideIntObj((Tcl_WideInt) regexpPtr->re.re_nsub));
+ TclNewWideIntObjFromSize(regexpPtr->re.re_nsub));
/*
* Now append a list of all the bit-flags set for the RE.