library: trade 2 strstr & atoi calls for 1 sscanf call
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
2a539477b7
commit
9a5a155e75
@ -1077,11 +1077,8 @@ static void autogroup_fill (const char *path, proc_t *p) {
|
||||
close(fd);
|
||||
if (in > 0) {
|
||||
buf[in] = '\0';
|
||||
if ((str = strstr(buf, "-")))
|
||||
p->autogrp_id = atoi(++str);
|
||||
if ((str = strstr(buf, "nice")))
|
||||
p->autogrp_nice = atoi(str + sizeof("nice"));
|
||||
// above sizeof includes null, skips space ahead of #
|
||||
sscanf(buf, "/autogroup-%d nice %d"
|
||||
, &p->autogrp_id, &p->autogrp_nice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user