diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2004-05-18 09:29:27 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2004-05-18 09:29:27 (GMT) |
commit | f835d3db835f97e7ee1c56a02b85fa333f227ea7 (patch) | |
tree | 4ebf88233f218d49dd7c5d37bd16bcb1046081d1 /generic | |
parent | 38c8ba15dd7e0173d250b17812065aeedcec5695 (diff) | |
download | tcl-f835d3db835f97e7ee1c56a02b85fa333f227ea7.zip tcl-f835d3db835f97e7ee1c56a02b85fa333f227ea7.tar.gz tcl-f835d3db835f97e7ee1c56a02b85fa333f227ea7.tar.bz2 |
Tests of limit-exceeded callbacks and make sure that those callbacks can remove
the limits if they see fit (as well as extending them).
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclInterp.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/generic/tclInterp.c b/generic/tclInterp.c index 616c244..01a73d1 100644 --- a/generic/tclInterp.c +++ b/generic/tclInterp.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInterp.c,v 1.28 2004/05/13 20:31:08 dkf Exp $ + * RCS: @(#) $Id: tclInterp.c,v 1.29 2004/05/18 09:29:30 dkf Exp $ */ #include "tclInt.h" @@ -2634,12 +2634,13 @@ Tcl_LimitCheck(interp) RunLimitHandlers(iPtr->limit.cmdHandlers, interp); if (iPtr->limit.cmdCount >= iPtr->cmdCount) { iPtr->limit.exceeded &= ~TCL_LIMIT_COMMANDS; - } else { + } else if (iPtr->limit.exceeded & TCL_LIMIT_COMMANDS) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "command count limit exceeded", NULL); Tcl_Release(interp); return TCL_ERROR; } + Tcl_Release(interp); } if ((iPtr->limit.active & TCL_LIMIT_TIME) && @@ -2658,12 +2659,13 @@ Tcl_LimitCheck(interp) (iPtr->limit.time.sec == now.sec && iPtr->limit.time.usec < now.usec)) { iPtr->limit.exceeded &= ~TCL_LIMIT_TIME; - } else { + } else if (iPtr->limit.exceeded & TCL_LIMIT_TIME) { Tcl_ResetResult(interp); Tcl_AppendResult(interp, "time limit exceeded", NULL); Tcl_Release(interp); return TCL_ERROR; } + Tcl_Release(interp); } } @@ -2884,6 +2886,7 @@ Tcl_LimitTypeReset(interp, type) Interp *iPtr = (Interp *) interp; iPtr->limit.active &= ~type; + iPtr->limit.exceeded &= ~type; } void |