[PATCH] libalpm: mark filelist_contains as taking a const filelist

morganamilo morganamilo at archlinux.org
Sun Jan 9 16:58:55 UTC 2022


This is useful for bindings as it gaurintees the value will not be
changed.
---
 lib/libalpm/alpm.h     | 2 +-
 lib/libalpm/filelist.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index e108213b..f1485bd8 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -161,7 +161,7 @@ typedef struct _alpm_backup_t {
  * @param path the path to search for in the package
  * @return a pointer to the matching file or NULL if not found
  */
-alpm_file_t *alpm_filelist_contains(alpm_filelist_t *filelist, const char *path);
+alpm_file_t *alpm_filelist_contains(const alpm_filelist_t *filelist, const char *path);
 
 /** Frees a file list */
 void  alpm_filelist_free(alpm_filelist_t *files);
diff --git a/lib/libalpm/filelist.c b/lib/libalpm/filelist.c
index 9dfe2012..ffdde9b6 100644
--- a/lib/libalpm/filelist.c
+++ b/lib/libalpm/filelist.c
@@ -118,7 +118,7 @@ static int _alpm_files_cmp(const void *f1, const void *f2)
 	return strcmp(file1->name, file2->name);
 }
 
-alpm_file_t SYMEXPORT *alpm_filelist_contains(alpm_filelist_t *filelist,
+alpm_file_t SYMEXPORT *alpm_filelist_contains(const alpm_filelist_t *filelist,
 		const char *path)
 {
 	alpm_file_t key;
-- 
2.34.1



More information about the pacman-dev mailing list