diff options
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); } /* |