diff mbox

[PATCHv2,1/3] libiberty/hashtab: More const parameters

Message ID 81e363828d0995ecb7a89d056faf7d70c35a5b29.1580171514.git.andrew.burgess@embecosm.com
State New
Headers show

Commit Message

Andrew Burgess Jan. 28, 2020, 12:36 a.m. UTC
Makes some parameters const in libiberty's hashtab library.

include/ChangeLog:

	* hashtab.h (htab_remove_elt): Make a parameter const.
	(htab_remove_elt_with_hash): Likewise.

libiberty/ChangeLog:

	* hashtab.c (htab_remove_elt): Make a parameter const.
	(htab_remove_elt_with_hash): Likewise.

Change-Id: Id416d5c9274285221533e3128c90485ba27846f2
---
 include/ChangeLog   | 5 +++++
 include/hashtab.h   | 4 ++--
 libiberty/ChangeLog | 5 +++++
 libiberty/hashtab.c | 4 ++--
 4 files changed, 14 insertions(+), 4 deletions(-)

Comments

Andrew Burgess Feb. 25, 2020, 5:35 p.m. UTC | #1
* Andrew Burgess <andrew.burgess@embecosm.com> [2020-01-28 00:36:57 +0000]:

> Makes some parameters const in libiberty's hashtab library.
> 
> include/ChangeLog:
> 
> 	* hashtab.h (htab_remove_elt): Make a parameter const.
> 	(htab_remove_elt_with_hash): Likewise.
> 
> libiberty/ChangeLog:
> 
> 	* hashtab.c (htab_remove_elt): Make a parameter const.
> 	(htab_remove_elt_with_hash): Likewise.

This patch has now been merged.

Thanks,
Andrew

> 
> Change-Id: Id416d5c9274285221533e3128c90485ba27846f2
> ---
>  include/ChangeLog   | 5 +++++
>  include/hashtab.h   | 4 ++--
>  libiberty/ChangeLog | 5 +++++
>  libiberty/hashtab.c | 4 ++--
>  4 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/include/hashtab.h b/include/hashtab.h
> index d94b54c3c41..6cca342b989 100644
> --- a/include/hashtab.h
> +++ b/include/hashtab.h
> @@ -173,8 +173,8 @@ extern void *	htab_find_with_hash (htab_t, const void *, hashval_t);
>  extern void **	htab_find_slot_with_hash (htab_t, const void *,
>  					  hashval_t, enum insert_option);
>  extern void	htab_clear_slot	(htab_t, void **);
> -extern void	htab_remove_elt	(htab_t, void *);
> -extern void	htab_remove_elt_with_hash (htab_t, void *, hashval_t);
> +extern void	htab_remove_elt	(htab_t, const void *);
> +extern void	htab_remove_elt_with_hash (htab_t, const void *, hashval_t);
>  
>  extern void	htab_traverse (htab_t, htab_trav, void *);
>  extern void	htab_traverse_noresize (htab_t, htab_trav, void *);
> diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c
> index 26c98ce2d68..225e9e540a7 100644
> --- a/libiberty/hashtab.c
> +++ b/libiberty/hashtab.c
> @@ -709,7 +709,7 @@ htab_find_slot (htab_t htab, const PTR element, enum insert_option insert)
>     element in the hash table, this function does nothing.  */
>  
>  void
> -htab_remove_elt (htab_t htab, PTR element)
> +htab_remove_elt (htab_t htab, const PTR element)
>  {
>    htab_remove_elt_with_hash (htab, element, (*htab->hash_f) (element));
>  }
> @@ -720,7 +720,7 @@ htab_remove_elt (htab_t htab, PTR element)
>     function does nothing.  */
>  
>  void
> -htab_remove_elt_with_hash (htab_t htab, PTR element, hashval_t hash)
> +htab_remove_elt_with_hash (htab_t htab, const PTR element, hashval_t hash)
>  {
>    PTR *slot;
>  
> -- 
> 2.14.5
>
diff mbox

Patch

diff --git a/include/hashtab.h b/include/hashtab.h
index d94b54c3c41..6cca342b989 100644
--- a/include/hashtab.h
+++ b/include/hashtab.h
@@ -173,8 +173,8 @@  extern void *	htab_find_with_hash (htab_t, const void *, hashval_t);
 extern void **	htab_find_slot_with_hash (htab_t, const void *,
 					  hashval_t, enum insert_option);
 extern void	htab_clear_slot	(htab_t, void **);
-extern void	htab_remove_elt	(htab_t, void *);
-extern void	htab_remove_elt_with_hash (htab_t, void *, hashval_t);
+extern void	htab_remove_elt	(htab_t, const void *);
+extern void	htab_remove_elt_with_hash (htab_t, const void *, hashval_t);
 
 extern void	htab_traverse (htab_t, htab_trav, void *);
 extern void	htab_traverse_noresize (htab_t, htab_trav, void *);
diff --git a/libiberty/hashtab.c b/libiberty/hashtab.c
index 26c98ce2d68..225e9e540a7 100644
--- a/libiberty/hashtab.c
+++ b/libiberty/hashtab.c
@@ -709,7 +709,7 @@  htab_find_slot (htab_t htab, const PTR element, enum insert_option insert)
    element in the hash table, this function does nothing.  */
 
 void
-htab_remove_elt (htab_t htab, PTR element)
+htab_remove_elt (htab_t htab, const PTR element)
 {
   htab_remove_elt_with_hash (htab, element, (*htab->hash_f) (element));
 }
@@ -720,7 +720,7 @@  htab_remove_elt (htab_t htab, PTR element)
    function does nothing.  */
 
 void
-htab_remove_elt_with_hash (htab_t htab, PTR element, hashval_t hash)
+htab_remove_elt_with_hash (htab_t htab, const PTR element, hashval_t hash)
 {
   PTR *slot;