From owner-svn-src-all@freebsd.org Sat Jun 2 04:39:01 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35C62EFD451 for ; Sat, 2 Jun 2018 04:39:01 +0000 (UTC) (envelope-from eadler@freebsd.org) Received: from smtp.freebsd.org (unknown [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DC7EA6B438 for ; Sat, 2 Jun 2018 04:39:00 +0000 (UTC) (envelope-from eadler@freebsd.org) Received: from mail-yb0-f182.google.com (mail-yb0-f182.google.com [209.85.213.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) (Authenticated sender: eadler) by smtp.freebsd.org (Postfix) with ESMTPSA id A4FB91EC8E for ; Sat, 2 Jun 2018 04:39:00 +0000 (UTC) (envelope-from eadler@freebsd.org) Received: by mail-yb0-f182.google.com with SMTP id i1-v6so9425063ybe.1 for ; Fri, 01 Jun 2018 21:39:00 -0700 (PDT) X-Gm-Message-State: ALKqPwfakJ5ln8I8kvICdMfKKibaPigqaokS2xm5krFfnuKVcwfXqn7H 9iS6sIfkzeLrwCciMbYpMGkuEZTsb7BFJY2C4ZK4zQ== X-Google-Smtp-Source: ADUXVKKOv3JsGnhJ9QiXHG3UVwRCAgc/W2yueXEPKijznDDAJnhpSSk2URpRWNHT9UOsnqHSGA/BeBlKVbMe9l27GY0= X-Received: by 2002:a25:5c8a:: with SMTP id q132-v6mr7308106ybb.479.1527914340156; Fri, 01 Jun 2018 21:39:00 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:ef50:0:0:0:0:0 with HTTP; Fri, 1 Jun 2018 21:38:29 -0700 (PDT) In-Reply-To: <201806020432.w524WsNK084940@pdx.rh.CN85.dnsmgr.net> References: <201806020408.w5248r8u068839@repo.freebsd.org> <201806020432.w524WsNK084940@pdx.rh.CN85.dnsmgr.net> From: Eitan Adler Date: Fri, 1 Jun 2018 21:38:29 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r334518 - head/usr.bin/top To: "Rodney W. Grimes" Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jun 2018 04:39:01 -0000 On 1 June 2018 at 21:32, Rodney W. Grimes 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