From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 3FA83138334 for ; Thu, 2 Jan 2020 14:07:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id D8CF2E0A6A; Thu, 2 Jan 2020 14:07:07 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BDB33E0A53 for ; Thu, 2 Jan 2020 14:07:07 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E252F34DE6A for ; Thu, 2 Jan 2020 14:07:06 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 70E63AB for ; Thu, 2 Jan 2020 14:07:04 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1577972056.d0d205c64d76c416eb83422828e30aea544f4591.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qsize.c X-VCS-Directories: / X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: d0d205c64d76c416eb83422828e30aea544f4591 X-VCS-Branch: master Date: Thu, 2 Jan 2020 14:07:04 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 08e56249-ad01-46cf-bc28-8fc4989b0814 X-Archives-Hash: 470e6e83edb076fe09fa59fce664fa32 commit: d0d205c64d76c416eb83422828e30aea544f4591 Author: Fabian Groffen gentoo org> AuthorDate: Thu Jan 2 13:34:16 2020 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Thu Jan 2 13:34:16 2020 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=d0d205c6 qsize: push query atoms down to tree_foreach_pkg Signed-off-by: Fabian Groffen gentoo.org> qsize.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/qsize.c b/qsize.c index 1f1dfc9..5cf7dae 100644 --- a/qsize.c +++ b/qsize.c @@ -109,22 +109,6 @@ qsize_cb(tree_pkg_ctx *pkg_ctx, void *priv) FILE *fp; size_t num_files, num_nonfiles, num_ignored; uint64_t num_bytes; - bool showit = false; - - /* see if this cat/pkg is requested */ - if (array_cnt(state->atoms)) { - depend_atom *qatom; - - qatom = tree_get_atom(pkg_ctx, 0); - array_for_each(state->atoms, i, atom) - if (atom_compare(qatom, atom) == EQUAL) { - showit = true; - break; - } - } else - showit = true; - if (!showit) - return EXIT_SUCCESS; if ((fp = tree_pkg_vdb_fopenat_ro(pkg_ctx, "CONTENTS")) == NULL) return EXIT_SUCCESS; @@ -248,7 +232,13 @@ int qsize_main(int argc, char **argv) vdb = tree_open_vdb(portroot, portvdb); if (vdb != NULL) { - ret = tree_foreach_pkg_fast(vdb, qsize_cb, &state, NULL); + if (array_cnt(atoms) > 0) { + array_for_each(atoms, i, atom) { + ret = tree_foreach_pkg_fast(vdb, qsize_cb, &state, atom); + } + } else { + ret = tree_foreach_pkg_fast(vdb, qsize_cb, &state, NULL); + } tree_close(vdb); }