summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-06-06 08:20:11 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-06-06 08:20:11 (GMT)
commit040a8faa610cef27ea30d4f3781eae7cda6b1258 (patch)
tree38912c3b4c43a99b304d8e262fe54b1b1e2ce140
parentf86f9cf5f2da6809f0747865b3b13cba13d23fa0 (diff)
parentbd4765cf50cf1df6abe07db4cacd8fcae2e950c8 (diff)
downloadtcl-040a8faa610cef27ea30d4f3781eae7cda6b1258.zip
tcl-040a8faa610cef27ea30d4f3781eae7cda6b1258.tar.gz
tcl-040a8faa610cef27ea30d4f3781eae7cda6b1258.tar.bz2
Merge 8.7, and add some more usage of TCL_INDEX_NONE/TCL_AUTO_LENGTH
-rw-r--r--generic/regexec.c2
-rw-r--r--generic/tclInt.h4
-rw-r--r--generic/tclLiteral.c6
-rw-r--r--generic/tclRegexp.c2
4 files changed, 8 insertions, 6 deletions
diff --git a/generic/regexec.c b/generic/regexec.c
index 5ad8b17..f243968 100644
--- a/generic/regexec.c
+++ b/generic/regexec.c
@@ -885,7 +885,7 @@ cbrdissect(
MDEBUG(("cbackref n%d %d{%d-%d}\n", t->id, n, min, max));
/* get the backreferenced string */
- if (v->pmatch[n].rm_so == (size_t)-1) {
+ if (v->pmatch[n].rm_so == TCL_INDEX_NONE) {
return REG_NOMATCH;
}
brstring = v->start + v->pmatch[n].rm_so;
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 33462c04..90a9ae2 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -551,7 +551,7 @@ typedef struct CommandTrace {
struct CommandTrace *nextPtr;
/* Next in list of traces associated with a
* particular command. */
- size_t refCount; /* Used to ensure this structure is not
+ size_t refCount; /* Used to ensure this structure is not
* deleted too early. Keeps track of how many
* pieces of code have a pointer to this
* structure. */
@@ -1505,7 +1505,7 @@ typedef struct LiteralEntry {
* table, the number of ByteCode structures
* that share the literal object; the literal
* entry can be freed when refCount drops to
- * 0. If in a local literal table, -1. */
+ * 0. If in a local literal table, TCL_AUTO_LENGTH. */
Namespace *nsPtr; /* Namespace in which this literal is used. We
* try to avoid sharing literal non-FQ command
* names among different namespaces to reduce
diff --git a/generic/tclLiteral.c b/generic/tclLiteral.c
index e8fbd35..526ea2f 100644
--- a/generic/tclLiteral.c
+++ b/generic/tclLiteral.c
@@ -227,7 +227,9 @@ TclCreateLiteral(
if (flags & LITERAL_ON_HEAP) {
Tcl_Free((void *)bytes);
}
- globalPtr->refCount++;
+ if (globalPtr->refCount != TCL_AUTO_LENGTH) {
+ globalPtr->refCount++;
+ }
return objPtr;
}
}
@@ -847,7 +849,7 @@ TclReleaseLiteral(
* literal table entry (decrement the ref count of the object).
*/
- if (entryPtr->refCount-- <= 1) {
+ if ((entryPtr->refCount != TCL_AUTO_LENGTH) && (entryPtr->refCount-- <= 1)) {
if (prevPtr == NULL) {
globalTablePtr->buckets[index] = entryPtr->nextPtr;
} else {
diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c
index 5df76c3..53241ef 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 == (size_t)-1) {
+ } else if (regexpPtr->matches[index].rm_so == TCL_INDEX_NONE) {
*startPtr = *endPtr = NULL;
} else {
if (regexpPtr->objPtr) {