Changeset 11571 in vbox for trunk/src/VBox/Main/Performance.cpp
- Timestamp:
- Aug 22, 2008 12:19:56 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/Performance.cpp
r11501 r11571 454 454 } 455 455 456 /* The following method was borrowed from VMM/STAM.cpp */ 457 bool Filter::patternMatch(const char *pszPat, const char *pszName) 458 { 459 /* ASSUMES ASCII */ 460 for (;;) 461 { 462 char chPat = *pszPat; 463 switch (chPat) 464 { 465 default: 466 if (*pszName != chPat) 467 return false; 468 break; 469 470 case '*': 471 { 472 while ((chPat = *++pszPat) == '*' || chPat == '?') 473 /* nothing */; 474 475 for (;;) 476 { 477 char ch = *pszName++; 478 if ( ch == chPat 479 && ( !chPat 480 || patternMatch(pszPat + 1, pszName))) 481 return true; 482 if (!ch) 483 return false; 484 } 485 /* won't ever get here */ 486 break; 487 } 488 489 case '?': 490 if (!*pszName) 491 return false; 492 break; 493 494 case '\0': 495 return !*pszName; 496 } 497 pszName++; 498 pszPat++; 499 } 500 return true; 501 } 502 456 503 bool Filter::match(const ComPtr<IUnknown> object, const std::string &name) const 457 504 { … … 465 512 { 466 513 // Objects match, compare names 467 if ( (*it).second == "*" || (*it).second == name)514 if (patternMatch((*it).second.c_str(), name.c_str())) 468 515 { 469 516 LogFlowThisFunc(("...found!\n"));
Note:
See TracChangeset
for help on using the changeset viewer.