Date: Fri, 1 Jun 2018 21:38:29 -0700 From: Eitan Adler <eadler@freebsd.org> To: "Rodney W. Grimes" <rgrimes@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r334518 - head/usr.bin/top Message-ID: <CAF6rxgnxkpsb%2Br_WDH-3LYG9Bf5psvLXYW_u%2BQMg1DiBnTROPQ@mail.gmail.com> In-Reply-To: <201806020432.w524WsNK084940@pdx.rh.CN85.dnsmgr.net> References: <201806020408.w5248r8u068839@repo.freebsd.org> <201806020432.w524WsNK084940@pdx.rh.CN85.dnsmgr.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On 1 June 2018 at 21:32, Rodney W. Grimes <freebsd@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAF6rxgnxkpsb%2Br_WDH-3LYG9Bf5psvLXYW_u%2BQMg1DiBnTROPQ>