Fix parsing of threads in stress/memory tests (#5695)
* Fix parsing of threads in stress/memory tests * Replace `char*` with `string` due `char*` can't be modified
This commit is contained in:
parent
84392f33d1
commit
97a9a76ff9
@ -24,14 +24,16 @@ std::string fileNameNoExt(const std::string &filepath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static size_t parseLine(char* line) {
|
/// Parses number from provided string
|
||||||
// This assumes that a digit will be found and the line ends in " Kb".
|
static int parseLine(std::string line) {
|
||||||
size_t i = strlen(line);
|
std::string res = "";
|
||||||
const char* p = line;
|
for (auto c: line)
|
||||||
while (*p <'0' || *p > '9') p++;
|
if (isdigit(c))
|
||||||
line[i-3] = '\0';
|
res += c;
|
||||||
i = (size_t)atoi(p);
|
if (res.empty())
|
||||||
return i;
|
// If number wasn't found return -1
|
||||||
|
return -1;
|
||||||
|
return std::stoi(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
Loading…
Reference in New Issue
Block a user