MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / parseUnits

Method parseUnits

src/arguments.cpp:530–552  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

528}
529
530long Arguments::parseUnits(const char* str, const Multiplier* multipliers) {
531 char* end;
532 long result = strtol(str, &end, 0);
533 if (end == str) {
534 return -1;
535 }
536
537 char c = *end;
538 if (c == 0) {
539 return result;
540 }
541 if (c >= 'A' && c <= 'Z') {
542 c += 'a' - 'A';
543 }
544
545 for (const Multiplier* m = multipliers; m->symbol; m++) {
546 if (c == m->symbol) {
547 return result * m->multiplier;
548 }
549 }
550
551 return -1;
552}
553
554int Arguments::parseTimeout(const char* str) {
555 const char* p = strchr(str, ':');

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected