summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbch <brad.harder@gmail.com>2015-02-07 21:12:18 (GMT)
committerbch <brad.harder@gmail.com>2015-02-07 21:12:18 (GMT)
commit1dcecc86911575eedfda9caede53f086bbbf0ad4 (patch)
tree4d6163ec31594e68e75a1b18e2b4de0fbb18c728
parent80c303fe985156a04d9565cc50a77e52c4f62269 (diff)
parentb45286725aeaf89d746d3f7edc0f125a4c0950a3 (diff)
downloadtcl-1dcecc86911575eedfda9caede53f086bbbf0ad4.zip
tcl-1dcecc86911575eedfda9caede53f086bbbf0ad4.tar.gz
tcl-1dcecc86911575eedfda9caede53f086bbbf0ad4.tar.bz2
merge [trunk]
-rw-r--r--generic/regcomp.c14
-rw-r--r--generic/regexec.c4
-rw-r--r--generic/regguts.h2
-rw-r--r--generic/tclIO.c4
-rw-r--r--generic/tclVar.c2
-rw-r--r--tests/io.test19
6 files changed, 32 insertions, 13 deletions
diff --git a/generic/regcomp.c b/generic/regcomp.c
index c93eb24..7ca4346 100644
--- a/generic/regcomp.c
+++ b/generic/regcomp.c
@@ -996,13 +996,13 @@ parseqatom(
switch (v->nexttype) {
case '*':
m = 0;
- n = INFINITY;
+ n = DUPINF;
qprefer = (v->nextvalue) ? LONGER : SHORTER;
NEXT();
break;
case '+':
m = 1;
- n = INFINITY;
+ n = DUPINF;
qprefer = (v->nextvalue) ? LONGER : SHORTER;
NEXT();
break;
@@ -1019,7 +1019,7 @@ parseqatom(
if (SEE(DIGIT)) {
n = scannum(v);
} else {
- n = INFINITY;
+ n = DUPINF;
}
if (m > n) {
ERR(REG_BADBR);
@@ -1217,8 +1217,8 @@ parseqatom(
*/
dupnfa(v->nfa, atom->begin, atom->end, s, atom->begin);
- assert(m >= 1 && m != INFINITY && n >= 1);
- repeat(v, s, atom->begin, m-1, (n == INFINITY) ? n : n-1);
+ assert(m >= 1 && m != DUPINF && n >= 1);
+ repeat(v, s, atom->begin, m-1, (n == DUPINF) ? n : n-1);
f = COMBINE(qprefer, atom->flags);
t = subre(v, '.', f, s, atom->end); /* prefix and atom */
NOERR();
@@ -1323,7 +1323,7 @@ repeat(
#define SOME 2
#define INF 3
#define PAIR(x, y) ((x)*4 + (y))
-#define REDUCE(x) ( ((x) == INFINITY) ? INF : (((x) > 1) ? SOME : (x)) )
+#define REDUCE(x) ( ((x) == DUPINF) ? INF : (((x) > 1) ? SOME : (x)) )
const int rm = REDUCE(m);
const int rn = REDUCE(n);
struct state *s, *s2;
@@ -2108,7 +2108,7 @@ stdump(
}
if (t->min != 1 || t->max != 1) {
fprintf(f, " {%d,", t->min);
- if (t->max != INFINITY) {
+ if (t->max != DUPINF) {
fprintf(f, "%d", t->max);
}
fprintf(f, "}");
diff --git a/generic/regexec.c b/generic/regexec.c
index ad4b6e6..3b9af3e 100644
--- a/generic/regexec.c
+++ b/generic/regexec.c
@@ -1122,7 +1122,7 @@ complicatedBackrefDissect(
*/
i = 0;
- for (p = begin; p <= stop && (i < max || max == INFINITY); p += len) {
+ for (p = begin; p <= stop && (i < max || max == DUPINF); p += len) {
if (v->g->compare(paren, p, len) != 0) {
break;
}
@@ -1137,7 +1137,7 @@ complicatedBackrefDissect(
if (p != end) { /* didn't consume all of it */
return REG_NOMATCH;
}
- if (min <= i && (i <= max || max == INFINITY)) {
+ if (min <= i && (i <= max || max == DUPINF)) {
return REG_OKAY;
}
return REG_NOMATCH; /* out of range */
diff --git a/generic/regguts.h b/generic/regguts.h
index b478e4c..1b6abe6 100644
--- a/generic/regguts.h
+++ b/generic/regguts.h
@@ -99,7 +99,7 @@
#define xxx 1
#define DUPMAX _POSIX2_RE_DUP_MAX
-#define INFINITY (DUPMAX+1)
+#define DUPINF (DUPMAX+1)
#define REMAGIC 0xfed7 /* magic number for main struct */
diff --git a/generic/tclIO.c b/generic/tclIO.c
index eb33106..025708b 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -5743,8 +5743,8 @@ DoReadChars(
chanPtr = statePtr->topChanPtr;
TclChannelPreserve((Tcl_Channel)chanPtr);
- /* Must clear the BLOCKED flag here since we check before reading */
- ResetFlag(statePtr, CHANNEL_BLOCKED);
+ /* Must clear the BLOCKED|EOF flags here since we check before reading */
+ ResetFlag(statePtr, CHANNEL_BLOCKED|CHANNEL_EOF);
for (copied = 0; (unsigned) toRead > 0; ) {
copiedNow = -1;
if (statePtr->inQueueHead != NULL) {
diff --git a/generic/tclVar.c b/generic/tclVar.c
index ec4c13c..0228a2c 100644
--- a/generic/tclVar.c
+++ b/generic/tclVar.c
@@ -4746,7 +4746,7 @@ Tcl_GetVariableFullName(
} else if (iPtr->varFramePtr->procPtr) {
int index = varPtr - iPtr->varFramePtr->compiledLocals;
- if (index < iPtr->varFramePtr->numCompiledLocals) {
+ if (index >= 0 && index < iPtr->varFramePtr->numCompiledLocals) {
namePtr = localName(iPtr->varFramePtr, index);
Tcl_AppendObjToObj(objPtr, namePtr);
}
diff --git a/tests/io.test b/tests/io.test
index cd8b014..06ae81d 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -8523,6 +8523,25 @@ test io-73.3 {[5adc350683] [gets] after EOF} -setup {
removeFile io-73.3
} -result {1 1 {more data} 0 {} 1}
+test io-73.4 {[5adc350683] [read] after EOF} -setup {
+ set fn [makeFile {} io-73.4]
+ set rfd [open $fn r]
+ set wfd [open $fn a]
+ chan configure $wfd -buffering line
+ read $rfd
+} -body {
+ set result [eof $rfd]
+ puts $wfd "more data"
+ lappend result [eof $rfd]
+ lappend result [read $rfd]
+ lappend result [eof $rfd]
+} -cleanup {
+ close $wfd
+ close $rfd
+ removeFile io-73.4
+} -result {1 1 {more data
+} 1}
+
# ### ### ### ######### ######### #########
# cleanup