~ubuntu-branches/ubuntu/raring/tcl8.5/raring

« back to all changes in this revision

Viewing changes to generic/tclRegexp.c

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2007-12-25 16:10:04 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20071225161004-zr4n8bj42nh1ybll
Tags: 8.5.0-2
Again disabled stack checking on hppa architecture since it doesn't
work yet.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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.
12
12
 *
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 $
14
14
 */
15
15
 
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;
452
452
 
453
453
        /*
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
457
457
         */
458
458
 
459
 
        if (textObj->typePtr == &tclStringType) {
460
 
            Tcl_UniChar *uptn;
461
 
            int plen;
462
 
 
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;
468
 
            int plen;
469
 
 
470
 
            data = Tcl_GetByteArrayFromObj(textObj, &length);
471
 
            ptn  = Tcl_GetByteArrayFromObj(regexpPtr->globObjPtr, &plen);
472
 
            match = TclByteArrayMatch(data, length, ptn, plen);
473
 
        } else {
474
 
            match = Tcl_StringCaseMatch(TclGetString(textObj),
475
 
                    TclGetString(regexpPtr->globObjPtr), nocase);
476
 
        }
477
 
        return match;
 
459
        return TclStringMatchObj(textObj, regexpPtr->globObjPtr, nocase);
478
460
    }
479
461
 
480
462
    /*