From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id DCE451384B4 for ; Sat, 28 Nov 2015 02:44:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DA82621C088; Sat, 28 Nov 2015 02:44:39 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C3FB921C01D for ; Sat, 28 Nov 2015 02:44:38 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 496F9340686 for ; Sat, 28 Nov 2015 02:44:37 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AD8F7E68 for ; Sat, 28 Nov 2015 02:44:34 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1448651533.6c142af26118bd69597860582c27934238334749.vapier@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: qcache.c X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 6c142af26118bd69597860582c27934238334749 X-VCS-Branch: master Date: Sat, 28 Nov 2015 02:44:34 +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-Archives-Salt: 8970ed4d-1756-4d52-b19f-93e38568eeb0 X-Archives-Hash: 25030ac120e41e91ed0d0ee87056ebba commit: 6c142af26118bd69597860582c27934238334749 Author: Mike Frysinger gentoo org> AuthorDate: Fri Nov 27 19:12:13 2015 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Fri Nov 27 19:12:13 2015 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=6c142af2 qcache: use scandir_free qcache.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/qcache.c b/qcache.c index 5f65fe0..5d915bd 100644 --- a/qcache.c +++ b/qcache.c @@ -528,10 +528,8 @@ int qcache_traverse(void (*func)(qcache_data*)) if (qcache_matchcat) { if (strcmp(categories[i]->d_name, qcache_matchcat) != 0) { - for (j = 0; j < num_pkg; j++) - free(packages[j]); + scandir_free(packages, num_pkg); free(categories[i]); - free(packages); free(pkgpath); continue; } @@ -552,10 +550,8 @@ int qcache_traverse(void (*func)(qcache_data*)) if (qcache_matchpkg) { if (strcmp(packages[j]->d_name, qcache_matchpkg) != 0) { - for (k = 0; k < num_ebuild; k++) - free(ebuilds[k]); + scandir_free(ebuilds, num_ebuild); free(packages[j]); - free(ebuilds); free(ebuildpath); continue; } @@ -741,7 +737,7 @@ void qcache_stats(qcache_data *data) static int *packages_testing; static int *current_package_keywords; static int *keywords; - int a, i; + int a; if (!numpkg) { struct dirent **categories; @@ -753,10 +749,7 @@ void qcache_stats(qcache_data *data) errp("%s", catpath); free(catpath); } - - for (i = 0; i < numcat; i++) - free(categories[i]); - free(categories); + scandir_free(categories, numcat); runtime = time(NULL);