Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage-utils:master commit in: /
Date: Sat, 28 Nov 2015 02:44:41
Message-Id: 1448651533.6c142af26118bd69597860582c27934238334749.vapier@gentoo
1 commit: 6c142af26118bd69597860582c27934238334749
2 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
3 AuthorDate: Fri Nov 27 19:12:13 2015 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Fri Nov 27 19:12:13 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=6c142af2
7
8 qcache: use scandir_free
9
10 qcache.c | 15 ++++-----------
11 1 file changed, 4 insertions(+), 11 deletions(-)
12
13 diff --git a/qcache.c b/qcache.c
14 index 5f65fe0..5d915bd 100644
15 --- a/qcache.c
16 +++ b/qcache.c
17 @@ -528,10 +528,8 @@ int qcache_traverse(void (*func)(qcache_data*))
18
19 if (qcache_matchcat) {
20 if (strcmp(categories[i]->d_name, qcache_matchcat) != 0) {
21 - for (j = 0; j < num_pkg; j++)
22 - free(packages[j]);
23 + scandir_free(packages, num_pkg);
24 free(categories[i]);
25 - free(packages);
26 free(pkgpath);
27 continue;
28 }
29 @@ -552,10 +550,8 @@ int qcache_traverse(void (*func)(qcache_data*))
30
31 if (qcache_matchpkg) {
32 if (strcmp(packages[j]->d_name, qcache_matchpkg) != 0) {
33 - for (k = 0; k < num_ebuild; k++)
34 - free(ebuilds[k]);
35 + scandir_free(ebuilds, num_ebuild);
36 free(packages[j]);
37 - free(ebuilds);
38 free(ebuildpath);
39 continue;
40 }
41 @@ -741,7 +737,7 @@ void qcache_stats(qcache_data *data)
42 static int *packages_testing;
43 static int *current_package_keywords;
44 static int *keywords;
45 - int a, i;
46 + int a;
47
48 if (!numpkg) {
49 struct dirent **categories;
50 @@ -753,10 +749,7 @@ void qcache_stats(qcache_data *data)
51 errp("%s", catpath);
52 free(catpath);
53 }
54 -
55 - for (i = 0; i < numcat; i++)
56 - free(categories[i]);
57 - free(categories);
58 + scandir_free(categories, numcat);
59
60 runtime = time(NULL);