svn commit: r334518 - head/usr.bin/top
Eitan Adler
eadler at freebsd.org
Sat Jun 2 04:39:01 UTC 2018
On 1 June 2018 at 21:32, Rodney W. Grimes
<freebsd at pdx.rh.cn85.dnsmgr.net> wrote:
>> Author: eadler
>> Date: Sat Jun 2 04:08:52 2018
>> New Revision: 334518
>> URL: https://svnweb.freebsd.org/changeset/base/334518
>>
>> Log:
>> top(1): help scan-build along a bit
>>
>> Teach scan-build that some arrays are larger than zero, and thus not to
>> warn.
>>
>> Modified:
>> head/usr.bin/top/display.c
>> head/usr.bin/top/machine.c
>>
>> Modified: head/usr.bin/top/display.c
>> swap_names = statics->swap_names;
>> num_swap = string_count(swap_names);
>> + assert(num_swap > 0);
>
> Isn't it valid to run without swap and then num_swap = 0?
I explicitly tested this case. num_swap comes from swap_names which
comes from swapnames which is defined as
static char *swapnames[] = {
"K Total, ", "K Used, ", "K Free, ", "% Inuse, ", "K In, ", "K Out",
NULL
};
In short: its poor naming :)
--
Eitan Adler
Source, Ports, Doc committer
Bugmeister, Ports Security teams
More information about the svn-src-all
mailing list