MCPcopy Create free account
hub / github.com/coreboot/coreboot / re_match_2

Function re_match_2

util/kconfig/regex.c:3157–4338  ·  view source on GitHub ↗
(bufp, string1, size1, string2, size2, pos, regs, stop)

Source from the content-addressed store, hash-verified

3155 matched substring. */
3156
3157int
3158re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
3159 struct re_pattern_buffer *bufp;
3160 const char *string1, *string2;
3161 int size1, size2;
3162 int pos;
3163 struct re_registers *regs;
3164 int stop;
3165{
3166 /* General temporaries. */
3167 int mcnt;
3168 unsigned char *p1;
3169
3170 /* Just past the end of the corresponding string. */
3171 const char *end1, *end2;
3172
3173 /* Pointers into string1 and string2, just past the last characters in
3174 each to consider matching. */
3175 const char *end_match_1, *end_match_2;
3176
3177 /* Where we are in the data, and the end of the current string. */
3178 const char *d, *dend;
3179
3180 /* Where we are in the pattern, and the end of the pattern. */
3181 unsigned char *p = bufp->buffer;
3182 register unsigned char *pend = p + bufp->used;
3183
3184 /* We use this to map every character in the string. */
3185 char *translate = bufp->translate;
3186
3187 /* Failure point stack. Each place that can handle a failure further
3188 down the line pushes a failure point on this stack. It consists of
3189 restart, regend, and reg_info for all registers corresponding to
3190 the subexpressions we're currently inside, plus the number of such
3191 registers, and, finally, two char *'s. The first char * is where
3192 to resume scanning the pattern; the second one is where to resume
3193 scanning the strings. If the latter is zero, the failure point is
3194 a ``dummy''; if a failure happens and the failure point is a dummy,
3195 it gets discarded and the next next one is tried. */
3196 fail_stack_type fail_stack;
3197#ifdef DEBUG
3198 static unsigned failure_id = 0;
3199 unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0;
3200#endif
3201
3202 /* We fill all the registers internally, independent of what we
3203 return, for use in backreferences. The number here includes
3204 an element for register zero. */
3205 unsigned num_regs = bufp->re_nsub + 1;
3206
3207 /* The currently active registers. */
3208 unsigned lowest_active_reg = NO_LOWEST_ACTIVE_REG;
3209 unsigned highest_active_reg = NO_HIGHEST_ACTIVE_REG;
3210
3211 /* Information on the contents of registers. These are pointers into
3212 the input strings; they record just what was matched (on this
3213 attempt) by a subexpression part of the pattern, that is, the
3214 regnum-th regstart pointer points to where in the pattern we began

Callers 2

re_search_2Function · 0.85
re_matchFunction · 0.85

Calls 3

bcmp_translateFunction · 0.85
abortFunction · 0.50

Tested by

no test coverage detected