10
10
* See the file "license.terms" for information on usage and redistribution of
11
11
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
13
* RCS: @(#) $Id: tclRegexp.c,v 1.26 2007/11/12 02:07:20 hobbs Exp $
13
* RCS: @(#) $Id: tclRegexp.c,v 1.28 2007/12/13 15:23:20 dgp Exp $
16
16
#include "tclInt.h"
448
448
if ((offset == 0) && (nmatches == 0) && (flags == 0)
449
449
&& !(reflags & ~TCL_REG_GLOBOK_FLAGS)
450
450
&& (regexpPtr->globObjPtr != NULL)) {
451
int match, nocase = (reflags & TCL_REG_NOCASE);
451
int nocase = (reflags & TCL_REG_NOCASE) ? TCL_MATCH_NOCASE : 0;
454
* Promote based on the type of incoming object.
454
* Pass to TclStringMatchObj for obj-specific handling.
455
455
* XXX: Currently doesn't take advantage of exact-ness that
456
456
* XXX: TclReToGlob tells us about
459
if (textObj->typePtr == &tclStringType) {
463
udata = Tcl_GetUnicodeFromObj(textObj, &length);
464
uptn = Tcl_GetUnicodeFromObj(regexpPtr->globObjPtr, &plen);
465
match = TclUniCharMatch(udata, length, uptn, plen, nocase);
466
} else if ((textObj->typePtr == &tclByteArrayType) && !nocase) {
467
unsigned char *data, *ptn;
470
data = Tcl_GetByteArrayFromObj(textObj, &length);
471
ptn = Tcl_GetByteArrayFromObj(regexpPtr->globObjPtr, &plen);
472
match = TclByteArrayMatch(data, length, ptn, plen);
474
match = Tcl_StringCaseMatch(TclGetString(textObj),
475
TclGetString(regexpPtr->globObjPtr), nocase);
459
return TclStringMatchObj(textObj, regexpPtr->globObjPtr, nocase);