From cef4c16d5ab82ead5e327bd9a97a69f7e4b7e2c2 Mon Sep 17 00:00:00 2001 From: dgp Date: Wed, 25 Feb 2009 19:59:30 +0000 Subject: * generic/tclUtil.c (TclStringMatchObj): Revised the branching on the strObj->typePtr so that untyped values get converted to the "string" type and pass through the Unicode matcher. [Bug 2613766] Also added checks to only perform "bytearray" optimization on pure bytearray values. [Bug 2637173]. --- ChangeLog | 6 ++++++ generic/tclUtil.c | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index defffef..3f670b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2009-02-25 Don Porter + * generic/tclUtil.c (TclStringMatchObj): Revised the branching + on the strObj->typePtr so that untyped values get converted to the + "string" type and pass through the Unicode matcher. [Bug 2613766] + Also added checks to only perform "bytearray" optimization on pure + bytearray values. [Bug 2637173]. + * generic/tclCmdMZ.c: Since Tcl_GetCharLength() has its own * generic/tclExecute.c: optimizations for the tclByteArrayType, stop having the callers do them. diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 9ea54b0..881edca 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclUtil.c,v 1.109 2009/02/10 23:09:05 nijtmans Exp $ + * RCS: @(#) $Id: tclUtil.c,v 1.110 2009/02/25 19:59:52 dgp Exp $ */ #include "tclInt.h" @@ -1760,13 +1760,14 @@ TclStringMatchObj( trivial = nocase ? 0 : TclMatchIsTrivial(TclGetString(ptnObj)); */ - if ((strObj->typePtr == &tclStringType)) { + if ((strObj->typePtr == &tclStringType) || (strObj->typePtr == NULL)) { Tcl_UniChar *udata, *uptn; udata = Tcl_GetUnicodeFromObj(strObj, &length); uptn = Tcl_GetUnicodeFromObj(ptnObj, &plen); match = TclUniCharMatch(udata, length, uptn, plen, flags); - } else if ((strObj->typePtr == &tclByteArrayType) && !flags) { + } else if ((strObj->typePtr == &tclByteArrayType) + && (strObj->bytes == NULL) && !flags) { unsigned char *data, *ptn; data = Tcl_GetByteArrayFromObj(strObj, &length); -- cgit v0.12