pike.git / src / modules / Regexp / pike_regexp.c

version» Context lines:

pike.git/src/modules/Regexp/pike_regexp.c:250:    * of the structure of the compiled regexp.    */   regexp *pike_regcomp(char *exp,int excompat)   {    register regexp *r;    register char *scan;    register char *longest;    register ptrdiff_t len;    int flags;    short *exp2,*dest,c; +  ONERROR oerr;       if (exp == (char *)NULL)    FAIL("NULL argument");       exp2=xalloc( (strlen(exp)+1) * sizeof(short) ); -  +  SET_ONERROR(oerr, free, exp2);    for ( scan=exp,dest=exp2;( c= UCHARAT(scan++)); ) {    switch (c) {    case '(':    case ')':    *dest++ = excompat ? c : c | SPECIAL;    break;    case '.':    case '*':    case '+':    case '|':
pike.git/src/modules/Regexp/pike_regexp.c:354:    for (; scan != NULL; scan = regnext(scan))    if (OP(scan) == EXACTLY &&    strlen(OPERAND(scan)) >= (size_t)len) {    longest = OPERAND(scan);    len = strlen(OPERAND(scan));    }    r->regmust = longest;    r->regmlen = len;    }    } -  free(exp2); +  +  CALL_AND_UNSET_ONERROR(oerr);    return (r);   }      /*    - reg - regular expression, i.e. main body or parenthesized thing    *    * Caller must absorb opening parenthesis.    *    * Combining parenthesis handling with the base level of regular expression    * is a trifle forced, but the need to tie the tails of the branches to what