MCPcopy Create free account
hub / github.com/apache/brpc / wildcmp

Function wildcmp

src/bvar/variable.cpp:372–404  ·  view source on GitHub ↗

Written by Jack Handy jakkhandy@hotmail.com

Source from the content-addressed store, hash-verified

370// Written by Jack Handy
371// <A href="mailto:jakkhandy@hotmail.com">jakkhandy@hotmail.com</A>
372inline bool wildcmp(const char* wild, const char* str, char question_mark) {
373 const char* cp = NULL;
374 const char* mp = NULL;
375
376 while (*str && *wild != '*') {
377 if (*wild != *str && *wild != question_mark) {
378 return false;
379 }
380 ++wild;
381 ++str;
382 }
383
384 while (*str) {
385 if (*wild == '*') {
386 if (!*++wild) {
387 return true;
388 }
389 mp = wild;
390 cp = str+1;
391 } else if (*wild == *str || *wild == question_mark) {
392 ++wild;
393 ++str;
394 } else {
395 wild = mp;
396 str = cp++;
397 }
398 }
399
400 while (*wild == '*') {
401 ++wild;
402 }
403 return !*wild;
404}
405
406class WildcardMatcher {
407public:

Callers 1

matchMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected