summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-31 22:03:55 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2019-03-31 22:03:55 (GMT)
commitffbc0140dad42d5145da92f1a68b45f5d217d86e (patch)
treeb1768aeba6a5fe1da6a3e674736623f3fe9e1073 /generic
parentb953a1cce7d339f6a522a656d58f08a156190583 (diff)
downloadtcl-ffbc0140dad42d5145da92f1a68b45f5d217d86e.zip
tcl-ffbc0140dad42d5145da92f1a68b45f5d217d86e.tar.gz
tcl-ffbc0140dad42d5145da92f1a68b45f5d217d86e.tar.bz2
Enhance documentations. Move TCL_INDEX_NONE from tclInt.h to tcl.h, since it's too useful.
Diffstat (limited to 'generic')
-rw-r--r--generic/tcl.h1
-rw-r--r--generic/tclEnv.c4
-rw-r--r--generic/tclInt.h1
-rw-r--r--generic/tclStringObj.c8
-rw-r--r--generic/tclUtf.c2
-rw-r--r--generic/tclUtil.c14
6 files changed, 15 insertions, 15 deletions
diff --git a/generic/tcl.h b/generic/tcl.h
index 7ca204a..98c1f2b 100644
--- a/generic/tcl.h
+++ b/generic/tcl.h
@@ -2168,6 +2168,7 @@ typedef int (Tcl_ArgvGenFuncProc)(void *clientData, Tcl_Interp *interp,
#define TCL_IO_FAILURE ((size_t)-1)
#define TCL_AUTO_LENGTH ((size_t)-1)
+#define TCL_INDEX_NONE ((size_t)-1)
/*
*----------------------------------------------------------------------------
diff --git a/generic/tclEnv.c b/generic/tclEnv.c
index 8598b9a..49b544d 100644
--- a/generic/tclEnv.c
+++ b/generic/tclEnv.c
@@ -230,7 +230,7 @@ TclSetEnv(
Tcl_MutexLock(&envMutex);
index = TclpFindVariable(name, &length);
- if (index == TCL_AUTO_LENGTH) {
+ if (index == TCL_INDEX_NONE) {
#ifndef USE_PUTENV
/*
* We need to handle the case where the environment may be changed
@@ -314,7 +314,7 @@ TclSetEnv(
* string in the cache.
*/
- if ((index != TCL_AUTO_LENGTH) && (environ[index] == p)) {
+ if ((index != TCL_INDEX_NONE) && (environ[index] == p)) {
ReplaceString(oldValue, p);
#ifdef HAVE_PUTENV_THAT_COPIES
} else {
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 44d0ec6..e815119 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -4117,7 +4117,6 @@ MODULE_SCOPE size_t TclIndexDecode(int encoded, size_t endValue);
/* Constants used in index value encoding routines. */
#define TCL_INDEX_END ((size_t)-2)
-#define TCL_INDEX_NONE ((size_t)-1) /* Index out of range or END+1 */
#define TCL_INDEX_START ((size_t)0)
/*
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c
index 590b1bd..9fc8a2b 100644
--- a/generic/tclStringObj.c
+++ b/generic/tclStringObj.c
@@ -1404,7 +1404,7 @@ AppendUnicodeToUnicodeRep(
numChars = stringPtr->numChars + appendNumChars;
if (numChars > stringPtr->maxChars) {
- size_t offset = TCL_AUTO_LENGTH;
+ size_t index = TCL_INDEX_NONE;
/*
* Protect against case where unicode points into the existing
@@ -1414,7 +1414,7 @@ AppendUnicodeToUnicodeRep(
if (unicode && unicode >= stringPtr->unicode
&& unicode <= stringPtr->unicode + stringPtr->maxChars) {
- offset = unicode - stringPtr->unicode;
+ index = unicode - stringPtr->unicode;
}
GrowUnicodeBuffer(objPtr, numChars);
@@ -1424,8 +1424,8 @@ AppendUnicodeToUnicodeRep(
* Relocate unicode if needed; see above.
*/
- if (offset != TCL_AUTO_LENGTH) {
- unicode = stringPtr->unicode + offset;
+ if (index != TCL_INDEX_NONE) {
+ unicode = stringPtr->unicode + index;
}
}
diff --git a/generic/tclUtf.c b/generic/tclUtf.c
index 8ab77d2..b893afb 100644
--- a/generic/tclUtf.c
+++ b/generic/tclUtf.c
@@ -1027,7 +1027,7 @@ Tcl_UtfAtIndex(
size_t len = 0;
#endif
- if (index != TCL_AUTO_LENGTH) {
+ if (index != TCL_INDEX_NONE) {
while (index--) {
#if TCL_UTF_MAX <= 4
src += (len = TclUtfToUniChar(src, &ch));
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index 9791e26..3dc4adb 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -2637,10 +2637,10 @@ Tcl_DStringInit(
char *
Tcl_DStringAppend(
Tcl_DString *dsPtr, /* Structure describing dynamic string. */
- const char *bytes, /* String to append. If length is -1 then this
- * must be null-terminated. */
+ const char *bytes, /* String to append. If length is
+ * TCL_AUTO_LENGTH then this must be null-terminated. */
size_t length) /* Number of bytes from "bytes" to append. If
- * -1, then append all of bytes, up to null
+ * TCL_AUTO_LENGTH, then append all of bytes, up to null
* at end. */
{
size_t newSize;
@@ -2664,18 +2664,18 @@ Tcl_DStringAppend(
memcpy(newString, dsPtr->string, dsPtr->length);
dsPtr->string = newString;
} else {
- size_t offset = TCL_AUTO_LENGTH;
+ size_t index = TCL_INDEX_NONE;
/* See [16896d49fd] */
if (bytes >= dsPtr->string
&& bytes <= dsPtr->string + dsPtr->length) {
- offset = bytes - dsPtr->string;
+ index = bytes - dsPtr->string;
}
dsPtr->string = Tcl_Realloc(dsPtr->string, dsPtr->spaceAvl);
- if (offset != TCL_AUTO_LENGTH) {
- bytes = dsPtr->string + offset;
+ if (index != TCL_INDEX_NONE) {
+ bytes = dsPtr->string + index;
}
}
}