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

version» Context lines:

pike.git/src/modules/Regexp/pike_regexp.c:1:   /* -  * $Id: pike_regexp.c,v 1.15 2000/08/11 13:04:22 grubba Exp $ +  * $Id: pike_regexp.c,v 1.16 2000/09/02 23:52:23 marcus Exp $    *    * regexp.c - regular expression matching    *    * DESCRIPTION    *    * Underneath the reformatting and comment blocks which were added to    * make it consistent with the rest of the code, you will find a    * modified version of Henry Specer's regular expression library.    * Henry's functions were modified to provide the minimal regular    * expression matching, as required by P1003. Henry's code was
pike.git/src/modules/Regexp/pike_regexp.c:977:    } while (scan != (char *)NULL && OP(scan) == BRANCH);    return (0);    /* NOTREACHED */    }    }    break;    case STAR:{    register char nextch;    register size_t no;    register char *save; -  register int minimum; +  register size_t minimum;       /*    * Lookahead to avoid useless match attempts when we know    * what character comes next.    */    nextch = '\0';    if (OP(nxt) == EXACTLY)    nextch = *OPERAND(nxt);    minimum = (OP(scan) == STAR) ? 0 : 1;    save = reginput; -  no = regrepeat(OPERAND(scan)) + (minimum == 0); -  while (no) { +  no = regrepeat(OPERAND(scan)); +  while (no >= minimum) {    /* If it could work, try it. */    if (nextch == '\0' || *reginput == nextch)    if (regmatch(nxt))    return (1);    /* Couldn't or didn't -- back up. */    no--;    reginput = save + no;    }    return (0);    }