diff options
author | hobbs <hobbs> | 2007-12-11 02:57:38 (GMT) |
---|---|---|
committer | hobbs <hobbs> | 2007-12-11 02:57:38 (GMT) |
commit | cf51bd54b5a287a462f703664196dbbfbfc072f1 (patch) | |
tree | e2366f37f9aceb9a418cb4d9a8a7ddfaed064e61 /generic/tclRegexp.c | |
parent | be008511dcfa73424dbbe3a12cdf3890759977ba (diff) | |
download | tcl-cf51bd54b5a287a462f703664196dbbfbfc072f1.zip tcl-cf51bd54b5a287a462f703664196dbbfbfc072f1.tar.gz tcl-cf51bd54b5a287a462f703664196dbbfbfc072f1.tar.bz2 |
* generic/tclInt.decls: move TclByteArrayMatch and TclReToGlob
* generic/tclIntDecls.h: to tclInt.h from stubs.
* generic/tclStubInit.c: Add flags var to TclByteArrayMatch for
* generic/tclInt.h: future extensibility
* generic/tcl.h: define TCL_MATCH_EXACT doc for Tcl_StringCaseMatch.
* doc/StrMatch.3: It is compatible with existing usage.
* generic/tclExecute.c (INST_STR_MATCH): flag for TclByteArrayMatch
* generic/tclUtil.c (TclByteArrayMatch, TclStringMatchObj):
* generic/tclRegexp.c (Tcl_RegExpExecObj):
* generic/tclCmdMZ.c (StringMatchCmd): Use TclStringMatchObj
* tests/string.test (11.9.* 11.10.*): more tests
Diffstat (limited to 'generic/tclRegexp.c')
-rw-r--r-- | generic/tclRegexp.c | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/generic/tclRegexp.c b/generic/tclRegexp.c index d24e9a8..3f064bf 100644 --- a/generic/tclRegexp.c +++ b/generic/tclRegexp.c @@ -10,7 +10,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclRegexp.c,v 1.26 2007/11/12 02:07:20 hobbs Exp $ + * RCS: @(#) $Id: tclRegexp.c,v 1.27 2007/12/11 02:57:44 hobbs Exp $ */ #include "tclInt.h" @@ -448,33 +448,15 @@ Tcl_RegExpExecObj( if ((offset == 0) && (nmatches == 0) && (flags == 0) && !(reflags & ~TCL_REG_GLOBOK_FLAGS) && (regexpPtr->globObjPtr != NULL)) { - int match, nocase = (reflags & TCL_REG_NOCASE); + int nocase = (reflags & TCL_REG_NOCASE) ? TCL_MATCH_NOCASE : 0; /* - * Promote based on the type of incoming object. + * Pass to TclStringMatchObj for obj-specific handling. * XXX: Currently doesn't take advantage of exact-ness that * XXX: TclReToGlob tells us about */ - if (textObj->typePtr == &tclStringType) { - Tcl_UniChar *uptn; - int plen; - - udata = Tcl_GetUnicodeFromObj(textObj, &length); - uptn = Tcl_GetUnicodeFromObj(regexpPtr->globObjPtr, &plen); - match = TclUniCharMatch(udata, length, uptn, plen, nocase); - } else if ((textObj->typePtr == &tclByteArrayType) && !nocase) { - unsigned char *data, *ptn; - int plen; - - data = Tcl_GetByteArrayFromObj(textObj, &length); - ptn = Tcl_GetByteArrayFromObj(regexpPtr->globObjPtr, &plen); - match = TclByteArrayMatch(data, length, ptn, plen); - } else { - match = Tcl_StringCaseMatch(TclGetString(textObj), - TclGetString(regexpPtr->globObjPtr), nocase); - } - return match; + return TclStringMatchObj(textObj, regexpPtr->globObjPtr, nocase); } /* |