Tcl Source Code

Check-in [a3d2988c14]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix [39f6304c2e] follow-up: Make Tcl_LinkVar toleranto to the empty string as well
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | core-8-6-branch
Files: files | file ages | folders
SHA1: a3d2988c14c555374847f8e322e1955bc94406c0
User & Date: jan.nijtmans 2017-01-20 16:20:27
Context
2017-01-31
13:15
Update documentation on recent changes in Tcl_LinkVar. Don't use TCL_NO_DEPRECATED for disabling tes... check-in: bd07313d9f user: jan.nijtmans tags: core-8-6-branch
2017-01-20
16:21
Fix [39f6304c2e] follow-up: Make Tcl_LinkVar toleranto to t... check-in: a1398bebc9 user: jan.nijtmans tags: trunk
16:20
Fix [39f6304c2e] follow-up: Make Tcl_LinkVar toleranto to t... check-in: a3d2988c14 user: jan.nijtmans tags: core-8-6-branch
16:18
Fix [39f6304c2e] follow-up: Make Tcl_LinkVar toleranto to t... check-in: 2579d7ff89 user: jan.nijtmans tags: core-8-5-branch
2017-01-19
22:37
Fix [1f4bb8162f]: lsort -dictionary documentation to be improved check-in: 931be8d1fb user: fvogel tags: core-8-6-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclLink.c.

718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737

738
739
740
741
742
743
744
745
    return TCL_ERROR;
}


/*
 * This function checks for integer representations, which are valid
 * when linking with C variables, but which are invalid in other
 * contexts in Tcl. Handled are "+", "-", "0x", "0b" and "0o" (upper-
 * and lowercase). See bug [39f6304c2e].
 */
int
GetInvalidIntFromObj(Tcl_Obj *objPtr,
				int *intPtr)
{
    int length;
    const char *str = TclGetStringFromObj(objPtr, &length);

    if ((length == 1) && strchr("+-", str[0])) {
	*intPtr = (str[0] == '+');
	return TCL_OK;

    } else if ((length == 2) && (str[0] == '0') && strchr("xXbBoO", str[1])) {
	*intPtr = 0;
	return TCL_OK;
    }
    return TCL_ERROR;
}

/*







|
|











>
|







718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
    return TCL_ERROR;
}


/*
 * This function checks for integer representations, which are valid
 * when linking with C variables, but which are invalid in other
 * contexts in Tcl. Handled are "", "+", "-", "0x", "0b" and "0o"
 * (upperand lowercase). See bug [39f6304c2e].
 */
int
GetInvalidIntFromObj(Tcl_Obj *objPtr,
				int *intPtr)
{
    int length;
    const char *str = TclGetStringFromObj(objPtr, &length);

    if ((length == 1) && strchr("+-", str[0])) {
	*intPtr = (str[0] == '+');
	return TCL_OK;
    } else if ((length == 0) ||
	    ((length == 2) && (str[0] == '0') && strchr("xXbBoO", str[1]))) {
	*intPtr = 0;
	return TCL_OK;
    }
    return TCL_ERROR;
}

/*