Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/be_local.c4
-rw-r--r--lib/libalpm/be_package.c3
-rw-r--r--lib/libalpm/be_sync.c3
-rw-r--r--lib/libalpm/filelist.c8
-rw-r--r--lib/libalpm/filelist.h2
5 files changed, 11 insertions, 9 deletions
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index 4ccbb1bf..97a49688 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -817,14 +817,12 @@ static int local_db_read(alpm_pkg_t *info, int inforeq)
if(newfiles != NULL) {
files = newfiles;
}
-
- /* make sure the list is sorted */
- qsort(files, files_count, sizeof(alpm_file_t), _alpm_files_cmp);
} else {
FREE(files);
}
info->files.count = files_count;
info->files.files = files;
+ _alpm_filelist_sort(&info->files);
continue;
nomem:
while(files_count > 0) {
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 319ccf8b..6859118d 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -676,8 +676,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
_alpm_log(handle, ALPM_LOG_DEBUG,
"sorting package filelist for %s\n", pkgfile);
- qsort(newpkg->files.files, newpkg->files.count,
- sizeof(alpm_file_t), _alpm_files_cmp);
+ _alpm_filelist_sort(&newpkg->files);
}
newpkg->infolevel |= INFRQ_FILES;
}
diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index 12be2dd0..5f7d31ab 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -735,13 +735,12 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
/* attempt to hand back any memory we don't need */
if(files_count > 0) {
files = realloc(files, sizeof(alpm_file_t) * files_count);
- /* make sure the list is sorted */
- qsort(files, files_count, sizeof(alpm_file_t), _alpm_files_cmp);
} else {
FREE(files);
}
pkg->files.count = files_count;
pkg->files.files = files;
+ _alpm_filelist_sort(&pkg->files);
}
}
if(ret != ARCHIVE_EOF) {
diff --git a/lib/libalpm/filelist.c b/lib/libalpm/filelist.c
index e360b1e9..46fb4b8d 100644
--- a/lib/libalpm/filelist.c
+++ b/lib/libalpm/filelist.c
@@ -111,7 +111,7 @@ alpm_list_t *_alpm_filelist_intersection(alpm_filelist_t *filesA,
/* Helper function for comparing files list entries
*/
-int _alpm_files_cmp(const void *f1, const void *f2)
+static int _alpm_files_cmp(const void *f1, const void *f2)
{
const alpm_file_t *file1 = f1;
const alpm_file_t *file2 = f2;
@@ -133,4 +133,10 @@ alpm_file_t SYMEXPORT *alpm_filelist_contains(alpm_filelist_t *filelist,
sizeof(alpm_file_t), _alpm_files_cmp);
}
+void _alpm_filelist_sort(alpm_filelist_t *filelist)
+{
+ qsort(filelist->files, filelist->count,
+ sizeof(alpm_file_t), _alpm_files_cmp);
+}
+
/* vim: set noet: */
diff --git a/lib/libalpm/filelist.h b/lib/libalpm/filelist.h
index b482c43a..c879058d 100644
--- a/lib/libalpm/filelist.h
+++ b/lib/libalpm/filelist.h
@@ -27,7 +27,7 @@ alpm_list_t *_alpm_filelist_difference(alpm_filelist_t *filesA,
alpm_list_t *_alpm_filelist_intersection(alpm_filelist_t *filesA,
alpm_filelist_t *filesB);
-int _alpm_files_cmp(const void *f1, const void *f2);
+void _alpm_filelist_sort(alpm_filelist_t *filelist);
#endif /* ALPM_FILELIST_H */