summaryrefslogtreecommitdiffstats
path: root/generic/tclObj.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-01-27 14:31:12 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-01-27 14:31:12 (GMT)
commit368a29cbf01f4aa930631726ce71aafe9c853f12 (patch)
treea2363b3cb1219295c38cd22d4f67ca2540b5446a /generic/tclObj.c
parentd95abe6b6fe069f55ce27900c99fec5949d63a15 (diff)
downloadtcl-368a29cbf01f4aa930631726ce71aafe9c853f12.zip
tcl-368a29cbf01f4aa930631726ce71aafe9c853f12.tar.gz
tcl-368a29cbf01f4aa930631726ce71aafe9c853f12.tar.bz2
Some code cleanup: More internal use of size_t, less type casts (because of this). No functional changes.
Diffstat (limited to 'generic/tclObj.c')
-rw-r--r--generic/tclObj.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/generic/tclObj.c b/generic/tclObj.c
index df900ce..d0f7480 100644
--- a/generic/tclObj.c
+++ b/generic/tclObj.c
@@ -2004,9 +2004,10 @@ static int
ParseBoolean(
register Tcl_Obj *objPtr) /* The object to parse/convert. */
{
- int i, length, newBool;
+ int newBool;
char lowerCase[6];
- const char *str = TclGetStringFromObj(objPtr, &length);
+ const char *str = TclGetString(objPtr);
+ size_t i, length = objPtr->length;
if ((length == 0) || (length > 5)) {
/*
@@ -2058,25 +2059,25 @@ ParseBoolean(
/*
* Checking the 'y' is redundant, but makes the code clearer.
*/
- if (strncmp(lowerCase, "yes", (size_t) length) == 0) {
+ if (strncmp(lowerCase, "yes", length) == 0) {
newBool = 1;
goto goodBoolean;
}
return TCL_ERROR;
case 'n':
- if (strncmp(lowerCase, "no", (size_t) length) == 0) {
+ if (strncmp(lowerCase, "no", length) == 0) {
newBool = 0;
goto goodBoolean;
}
return TCL_ERROR;
case 't':
- if (strncmp(lowerCase, "true", (size_t) length) == 0) {
+ if (strncmp(lowerCase, "true", length) == 0) {
newBool = 1;
goto goodBoolean;
}
return TCL_ERROR;
case 'f':
- if (strncmp(lowerCase, "false", (size_t) length) == 0) {
+ if (strncmp(lowerCase, "false", length) == 0) {
newBool = 0;
goto goodBoolean;
}
@@ -2085,10 +2086,10 @@ ParseBoolean(
if (length < 2) {
return TCL_ERROR;
}
- if (strncmp(lowerCase, "on", (size_t) length) == 0) {
+ if (strncmp(lowerCase, "on", length) == 0) {
newBool = 1;
goto goodBoolean;
- } else if (strncmp(lowerCase, "off", (size_t) length) == 0) {
+ } else if (strncmp(lowerCase, "off", length) == 0) {
newBool = 0;
goto goodBoolean;
}