library: trade 2 strstr & atoi calls for 1 sscanf call

Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
Jim Warner 2021-08-22 00:00:00 -05:00 committed by Craig Small
parent 2a539477b7
commit 9a5a155e75

View File

@ -1077,11 +1077,8 @@ static void autogroup_fill (const char *path, proc_t *p) {
close(fd); close(fd);
if (in > 0) { if (in > 0) {
buf[in] = '\0'; buf[in] = '\0';
if ((str = strstr(buf, "-"))) sscanf(buf, "/autogroup-%d nice %d"
p->autogrp_id = atoi(++str); , &p->autogrp_id, &p->autogrp_nice);
if ((str = strstr(buf, "nice")))
p->autogrp_nice = atoi(str + sizeof("nice"));
// above sizeof includes null, skips space ahead of #
} }
} }
} }