Tcl Source Code

View Ticket
Login
Ticket UUID: e832d2b08fc9e1d1ec9c354806fcdd7e89de6c39
Title: unnecessary code in Tcl_SetMaxBlockTime
Type: Bug Version: 8.6.0
Submitter: anonymous Created on: 2013-10-30 13:06:13
Subsystem: 01. Notifier Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2013-11-16 21:09:08
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2013-11-16 21:09:08
Description:
In generic/tclNotify.c, in the function Tcl_SetMaxBlockTime, checking for tsdPtr->blockTimeSet in the second if-clause is unnecessary. The current code looks as follows:

if (!tsdPtr->blockTimeSet || ...) {
    ...
    tsdPtr->blockTimeSet = 1;
}

if (!tsdPtr->inTraversal) {
    if (tsdPtr->blockTimeSet) {
        Tcl_SetTimer(&tsdPtr->blockTime);
    } else {
        Tcl_SetTimer(NULL);
    }
}

Either tsdPtr->blockTimeSet is already 1 when we enter this function, or otherwise the first if-clause will set it to 1. Therefore, the second if-clause can simply read

if (!tsdPtr->inTraversal) {
    Tcl_SetTimer(&tsdPtr->blockTime);
}
User Comments: jan.nijtmans added on 2013-11-16 21:09:08:

Fixed in core-8-5-branch [4c14f88702] and trunk [04b08d7303]