mirror of
https://github.com/aristocratos/btop.git
synced 2024-05-16 02:13:46 +12:00
extract delimiters
This commit is contained in:
parent
6e704ce838
commit
9732507248
|
@ -266,10 +266,11 @@ namespace Mem
|
|||
char buf[512];
|
||||
while (fgets(buf, sizeof(buf), fpIn) != NULL)
|
||||
{
|
||||
char *tokens = strtok(buf, ":\n.");
|
||||
char *delim = ":\n.";
|
||||
char *tokens = strtok(buf, delim);
|
||||
while (tokens) {
|
||||
char *label = tokens;
|
||||
char *val = strtok(nullptr, ":\n.");
|
||||
char *val = strtok(nullptr, delim);
|
||||
if (strstr(label, "Pages free"))
|
||||
{
|
||||
uint64_t f = stoull(trim(val));
|
||||
|
@ -278,7 +279,7 @@ namespace Mem
|
|||
// } else if (strstr(label, "Pages free")) {
|
||||
|
||||
}
|
||||
tokens = strtok(nullptr, ":\n.");
|
||||
tokens = strtok(nullptr, delim);
|
||||
}
|
||||
}
|
||||
pclose(fpIn);
|
||||
|
|
Loading…
Reference in a new issue