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:
parent
37e12bdafb
commit
74b29000be
@ -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++);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user