summaryrefslogtreecommitdiffstats
path: root/generic/tclListObj.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-02-02 15:50:49 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-02-02 15:50:49 (GMT)
commit9e08c549c98205fd2982142dc61fb7bd3a129141 (patch)
tree89fbfcbbb33b76e7ac710772c7ab0a900c071ef6 /generic/tclListObj.c
parentc9abd08463391eea2c29d413449d8ba0c4704363 (diff)
downloadtcl-9e08c549c98205fd2982142dc61fb7bd3a129141.zip
tcl-9e08c549c98205fd2982142dc61fb7bd3a129141.tar.gz
tcl-9e08c549c98205fd2982142dc61fb7bd3a129141.tar.bz2
In stead of testing for tclEmptyStringRep, in many situations it is better to check whether the string ends with '\0'.
Diffstat (limited to 'generic/tclListObj.c')
-rw-r--r--generic/tclListObj.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index 749f5f2..3369902 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.c
@@ -467,7 +467,7 @@ Tcl_ListObjGetElements(
if (listPtr->typePtr != &tclListType) {
int result;
- if (listPtr->bytes == tclEmptyStringRep) {
+ if (listPtr->bytes && !listPtr->bytes[0]) {
*objcPtr = 0;
*objvPtr = NULL;
return TCL_OK;
@@ -577,7 +577,7 @@ Tcl_ListObjAppendElement(
if (listPtr->typePtr != &tclListType) {
int result;
- if (listPtr->bytes == tclEmptyStringRep) {
+ if (listPtr->bytes && !listPtr->bytes[0]) {
Tcl_SetListObj(listPtr, 1, &objPtr);
return TCL_OK;
}
@@ -741,7 +741,7 @@ Tcl_ListObjIndex(
if (listPtr->typePtr != &tclListType) {
int result;
- if (listPtr->bytes == tclEmptyStringRep) {
+ if (listPtr->bytes && !listPtr->bytes[0]) {
*objPtrPtr = NULL;
return TCL_OK;
}
@@ -794,7 +794,7 @@ Tcl_ListObjLength(
if (listPtr->typePtr != &tclListType) {
int result;
- if (listPtr->bytes == tclEmptyStringRep) {
+ if (listPtr->bytes && !listPtr->bytes[0]) {
*intPtr = 0;
return TCL_OK;
}
@@ -865,7 +865,7 @@ Tcl_ListObjReplace(
Tcl_Panic("%s called with shared object", "Tcl_ListObjReplace");
}
if (listPtr->typePtr != &tclListType) {
- if (listPtr->bytes == tclEmptyStringRep) {
+ if (listPtr->bytes && !listPtr->bytes[0]) {
if (!objc) {
return TCL_OK;
}
@@ -1652,7 +1652,7 @@ TclListObjSetElement(
if (listPtr->typePtr != &tclListType) {
int result;
- if (listPtr->bytes == tclEmptyStringRep) {
+ if (listPtr->bytes && !listPtr->bytes[0]) {
if (interp != NULL) {
Tcl_SetObjResult(interp,
Tcl_NewStringObj("list index out of range", -1));