diff options
Diffstat (limited to 'generic/tclUtil.c')
-rw-r--r-- | generic/tclUtil.c | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 4ea9c2e..97ddea7 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -135,7 +135,7 @@ static const Tcl_ObjType endOffsetType = { NULL, /* freeIntRepProc */ NULL, /* dupIntRepProc */ NULL, /* updateStringProc */ - SetEndOffsetFromAny + NULL }; /* @@ -1391,9 +1391,9 @@ TclConvertElement( */ if ((src == NULL) || (length == 0) || (*src == '\0' && length == -1)) { - src = &tclEmptyString; - length = 0; - conversion = CONVERT_BRACE; + p[0] = '{'; + p[1] = '}'; + return 2; } /* @@ -2090,7 +2090,7 @@ Tcl_ConcatObj( resPtr = NULL; for (i = 0; i < objc; i++) { objPtr = objv[i]; - if (objPtr->bytes && objPtr->length == 0) { + if (!TclListObjIsCanonical(objPtr)) { continue; } if (resPtr) { @@ -3902,20 +3902,19 @@ TclGetIntForIndex( } return TCL_OK; } - /* *---------------------------------------------------------------------- * * GetEndOffsetFromObj -- * - * Look for a string of the form "end[+-]offset" and convert it to an - * internal representation holding the offset. + * Look for a string of the form "end[+-]offset" and convert it to an + * internal representation holding the offset. * * Results: - * Tcl return code. + * Tcl return code. * * Side effects: - * May store a Tcl_ObjType. + * May store a Tcl_ObjType. * *---------------------------------------------------------------------- */ @@ -4021,27 +4020,27 @@ SetEndOffsetFromAny( TCL_PARSE_INTEGER_ONLY) != TCL_OK) { return TCL_ERROR; } - if (objPtr->typePtr != &tclIntType) { - goto badIndexFormat; - } - offset = objPtr->internalRep.wideValue; - if (bytes[3] == '-') { + if (objPtr->typePtr != &tclIntType) { + goto badIndexFormat; + } + offset = objPtr->internalRep.wideValue; + if (bytes[3] == '-') { - /* TODO: Review overflow concerns here! */ - offset = -offset; - } + /* TODO: Review overflow concerns here! */ + offset = -offset; + } } else { - /* - * Conversion failed. Report the error. - */ + /* + * Conversion failed. Report the error. + */ badIndexFormat: - if (interp != NULL) { - Tcl_SetObjResult(interp, Tcl_ObjPrintf( - "bad index \"%s\": must be end?[+-]integer?", bytes)); - Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX", NULL); - } - return TCL_ERROR; + if (interp != NULL) { + Tcl_SetObjResult(interp, Tcl_ObjPrintf( + "bad index \"%s\": must be end?[+-]integer?", bytes)); + Tcl_SetErrorCode(interp, "TCL", "VALUE", "INDEX", NULL); + } + return TCL_ERROR; } /* |