Re: [PATCH 11/23] libsepol: mark read-only parameters of type_set_ interfaces const

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 8, 2021 at 12:02 PM Christian Göttsche
<cgzones@xxxxxxxxxxxxxx> wrote:
>
> Make it more obvious which parameters are read-only and not being
> modified and allow callers to pass const pointers.
>
> Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>

Acked-by: James Carter <jwcart2@xxxxxxxxx>

> ---
>  libsepol/include/sepol/policydb/policydb.h | 4 ++--
>  libsepol/src/policydb.c                    | 6 +++---
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/libsepol/include/sepol/policydb/policydb.h b/libsepol/include/sepol/policydb/policydb.h
> index c29339dc..78699fb4 100644
> --- a/libsepol/include/sepol/policydb/policydb.h
> +++ b/libsepol/include/sepol/policydb/policydb.h
> @@ -667,8 +667,8 @@ extern int scope_destroy(hashtab_key_t key, hashtab_datum_t datum, void *p);
>  extern void class_perm_node_init(class_perm_node_t * x);
>  extern void type_set_init(type_set_t * x);
>  extern void type_set_destroy(type_set_t * x);
> -extern int type_set_cpy(type_set_t * dst, type_set_t * src);
> -extern int type_set_or_eq(type_set_t * dst, type_set_t * other);
> +extern int type_set_cpy(type_set_t * dst, const type_set_t * src);
> +extern int type_set_or_eq(type_set_t * dst, const type_set_t * other);
>  extern void role_set_init(role_set_t * x);
>  extern void role_set_destroy(role_set_t * x);
>  extern void avrule_init(avrule_t * x);
> diff --git a/libsepol/src/policydb.c b/libsepol/src/policydb.c
> index 3389a943..7739b0fb 100644
> --- a/libsepol/src/policydb.c
> +++ b/libsepol/src/policydb.c
> @@ -1753,7 +1753,7 @@ int symtab_insert(policydb_t * pol, uint32_t sym,
>         return retval;
>  }
>
> -static int type_set_or(type_set_t * dst, type_set_t * a, type_set_t * b)
> +static int type_set_or(type_set_t * dst, const type_set_t * a, const type_set_t * b)
>  {
>         type_set_init(dst);
>
> @@ -1770,7 +1770,7 @@ static int type_set_or(type_set_t * dst, type_set_t * a, type_set_t * b)
>         return 0;
>  }
>
> -int type_set_cpy(type_set_t * dst, type_set_t * src)
> +int type_set_cpy(type_set_t * dst, const type_set_t * src)
>  {
>         type_set_init(dst);
>
> @@ -1783,7 +1783,7 @@ int type_set_cpy(type_set_t * dst, type_set_t * src)
>         return 0;
>  }
>
> -int type_set_or_eq(type_set_t * dst, type_set_t * other)
> +int type_set_or_eq(type_set_t * dst, const type_set_t * other)
>  {
>         int ret;
>         type_set_t tmp;
> --
> 2.32.0
>




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux