Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/be_package.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-24 00:40:03 -0500
committerDan McGee <dan@archlinux.org>2011-06-24 01:36:47 -0500
commitf12ead2cf278d4a9b330d0d320733960fc750e96 (patch)
tree28ff56150e10d9c212c46edfb3d34c137b9a61a9 /lib/libalpm/be_package.c
parentd589a7b5dbdfcf740d72aa4e9e8fcab9a3de0fbd (diff)
Remove three unnecessary usages of alpm_list_count()
For the files count when loading from a package, we can keep a counter. The two in the frontend were completely useless due to the fact that if sync_dbs is non-NULL, alpm_list_count() will always be greater than 0. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/be_package.c')
-rw-r--r--lib/libalpm/be_package.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 1807051d..748f27a0 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -241,6 +241,7 @@ pmpkg_t *_alpm_pkg_load_internal(pmhandle_t *handle, const char *pkgfile,
struct archive_entry *entry;
pmpkg_t *newpkg = NULL;
struct stat st;
+ size_t files_count = 0;
if(pkgfile == NULL || strlen(pkgfile) == 0) {
RET_ERR(handle, PM_ERR_WRONG_ARGS, NULL);
@@ -328,6 +329,7 @@ pmpkg_t *_alpm_pkg_load_internal(pmhandle_t *handle, const char *pkgfile,
} else if(full) {
/* Keep track of all files for filelist generation */
newpkg->files = alpm_list_add(newpkg->files, strdup(entry_name));
+ files_count++;
}
if(archive_read_data_skip(archive)) {
@@ -366,8 +368,7 @@ pmpkg_t *_alpm_pkg_load_internal(pmhandle_t *handle, const char *pkgfile,
if(full) {
/* "checking for conflicts" requires a sorted list, ensure that here */
_alpm_log(handle, PM_LOG_DEBUG, "sorting package filelist for %s\n", pkgfile);
- newpkg->files = alpm_list_msort(newpkg->files, alpm_list_count(newpkg->files),
- _alpm_str_cmp);
+ newpkg->files = alpm_list_msort(newpkg->files, files_count, _alpm_str_cmp);
newpkg->infolevel = INFRQ_ALL;
} else {
/* get rid of any partial filelist we may have collected, it is invalid */