linux: move sscanf() out of the assert()

If asserts are turned off then the sscanf() wouldn't have run, being
placed directly in the assert() itself.
This commit is contained in:
Trevor Norris 2014-01-22 12:16:06 -08:00 committed by Fedor Indutny
parent 37e12bdafb
commit 74b29000be

View File

@ -636,7 +636,9 @@ static int read_times(unsigned int numcpus, uv_cpu_info_t* ci) {
/* skip "cpu<num> " marker */ /* skip "cpu<num> " marker */
{ {
unsigned int n; unsigned int n;
assert(sscanf(buf, "cpu%u ", &n) == 1); int r = sscanf(buf, "cpu%u ", &n);
assert(r == 1);
(void) r; // silence build warning
for (len = sizeof("cpu0"); n /= 10; len++); for (len = sizeof("cpu0"); n /= 10; len++);
} }