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 CE70013997D for ; Wed, 13 Nov 2019 18:19:26 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E78AFE0880; Wed, 13 Nov 2019 18:19:25 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (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 C5715E0880 for ; Wed, 13 Nov 2019 18:19:25 +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 C131334CDAB for ; Wed, 13 Nov 2019 18:19:24 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 93F158AE for ; Wed, 13 Nov 2019 18:19:22 +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: <1573669135.2c99796e26485e2e838f4c36fc58e9f6b9267db0.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qmerge.c X-VCS-Directories: / X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 2c99796e26485e2e838f4c36fc58e9f6b9267db0 X-VCS-Branch: master Date: Wed, 13 Nov 2019 18:19:22 +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: 0efe7edc-8654-4ddc-a823-49a7ba938cbd X-Archives-Hash: fe4425daa3de38b0aaa374842a207b67 commit: 2c99796e26485e2e838f4c36fc58e9f6b9267db0 Author: Joakim Tjernlund infinera com> AuthorDate: Wed Nov 13 18:18:55 2019 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Wed Nov 13 18:18:55 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=2c99796e qmerge: allow -s without arguments to list available packages Signed-off-by: Fabian Groffen gentoo.org> qmerge.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/qmerge.c b/qmerge.c index 1196e67..c7b234e 100644 --- a/qmerge.c +++ b/qmerge.c @@ -2123,8 +2123,8 @@ parse_packages(set *todo) struct pkg_t Pkg; depend_atom *pkg_atom; char repo[sizeof(Pkg.REPO)]; - depend_atom **todo_atoms; - size_t todo_cnt; + depend_atom **todo_atoms = NULL; + size_t todo_cnt = 0; size_t i; fp = open_binpkg_index(); @@ -2161,7 +2161,7 @@ parse_packages(set *todo) strcpy(Pkg.SLOT, "0"); /* build list with exploded atoms for each access below */ - { + if (todo != NULL) { char **todo_strs; todo_cnt = list_set(todo, &todo_strs); todo_atoms = xmalloc(sizeof(*todo_atoms) * todo_cnt); @@ -2419,7 +2419,7 @@ int qmerge_main(int argc, char **argv) for (i = optind; i < argc; ++i) todo = qmerge_add_set(argv[i], todo); - if (todo == NULL) { + if (search_pkgs == 0 && todo == NULL) { warn("need package names to work with"); return EXIT_FAILURE; } @@ -2454,6 +2454,7 @@ int qmerge_main(int argc, char **argv) } ret = qmerge_run(todo); - free_set(todo); + if (todo != NULL) + free_set(todo); return ret; }