MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / max_expand

Function max_expand

deps/lua/src/lstrlib.c:301–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

299
300
301static const char *max_expand (MatchState *ms, const char *s,
302 const char *p, const char *ep) {
303 ptrdiff_t i = 0; /* counts maximum expand for item */
304 while ((s+i)<ms->src_end && singlematch(uchar(*(s+i)), p, ep))
305 i++;
306 /* keeps trying to match with the maximum repetitions */
307 while (i>=0) {
308 const char *res = match(ms, (s+i), ep+1);
309 if (res) return res;
310 i--; /* else didn't match; reduce 1 repetition to try again */
311 }
312 return NULL;
313}
314
315
316static const char *min_expand (MatchState *ms, const char *s,

Callers 1

matchFunction · 0.85

Calls 2

singlematchFunction · 0.85
matchFunction · 0.85

Tested by

no test coverage detected