libalpm: mark filelist_contains as taking a const filelist

Message ID 20220109165855.403762-1-morganamilo@archlinux.org
State New
Headers show
Series libalpm: mark filelist_contains as taking a const filelist | expand

Commit Message

morganamilo Jan. 9, 2022, 4:58 p.m. UTC
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(-)

Comments

Allan McRae March 6, 2022, 7:32 a.m. UTC | #1
On 10/1/22 02:58, morganamilo wrote:
> This is useful for bindings as it gaurintees the value will not be
> changed.

Fine.  I fixed the typo.

> ---
>   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;

Patch

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;