SELinux Archive mirror
 help / color / mirror / Atom feed
* [PATCH] libsepol: constify function pointer arrays
@ 2024-04-02 15:42 Christian Göttsche
  2024-04-03 19:51 ` James Carter
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Göttsche @ 2024-04-02 15:42 UTC (permalink / raw
  To: selinux; +Cc: Christian Göttsche

From: Christian Göttsche <cgzones@googlemail.com>

The function pointer arrays are never changed, declare them const.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 libsepol/src/policydb.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libsepol/src/policydb.c b/libsepol/src/policydb.c
index 0c23a7a2..49f9e8af 100644
--- a/libsepol/src/policydb.c
+++ b/libsepol/src/policydb.c
@@ -1126,7 +1126,7 @@ static int cat_index(hashtab_key_t key, hashtab_datum_t datum, void *datap)
 	return 0;
 }
 
-static int (*index_f[SYM_NUM]) (hashtab_key_t key, hashtab_datum_t datum,
+static int (*const index_f[SYM_NUM]) (hashtab_key_t key, hashtab_datum_t datum,
 				void *datap) = {
 common_index, class_index, role_index, type_index, user_index,
 	    cond_index_bool, sens_index, cat_index,};
@@ -1409,7 +1409,7 @@ static int cat_destroy(hashtab_key_t key, hashtab_datum_t datum, void *p
 	return 0;
 }
 
-static int (*destroy_f[SYM_NUM]) (hashtab_key_t key, hashtab_datum_t datum,
+static int (*const destroy_f[SYM_NUM]) (hashtab_key_t key, hashtab_datum_t datum,
 				  void *datap) = {
 common_destroy, class_destroy, role_destroy, type_destroy, user_destroy,
 	    cond_destroy_bool, sens_destroy, cat_destroy,};
@@ -3410,7 +3410,7 @@ static int cat_read(policydb_t * p
 	return -1;
 }
 
-static int (*read_f[SYM_NUM]) (policydb_t * p, hashtab_t h,
+static int (*const read_f[SYM_NUM]) (policydb_t * p, hashtab_t h,
 			       struct policy_file * fp) = {
 common_read, class_read, role_read, type_read, user_read,
 	    cond_read_bool, sens_read, cat_read,};
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] libsepol: constify function pointer arrays
  2024-04-02 15:42 [PATCH] libsepol: constify function pointer arrays Christian Göttsche
@ 2024-04-03 19:51 ` James Carter
  2024-04-04 16:23   ` James Carter
  0 siblings, 1 reply; 3+ messages in thread
From: James Carter @ 2024-04-03 19:51 UTC (permalink / raw
  To: Christian Göttsche; +Cc: selinux, Christian Göttsche

On Tue, Apr 2, 2024 at 11:46 AM Christian Göttsche
<cgoettsche@seltendoof.de> wrote:
>
> From: Christian Göttsche <cgzones@googlemail.com>
>
> The function pointer arrays are never changed, declare them const.
>
> Signed-off-by: Christian Göttsche <cgzones@googlemail.com>

Acked-by: James Carter <jwcart2@gmail.com>

> ---
>  libsepol/src/policydb.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libsepol/src/policydb.c b/libsepol/src/policydb.c
> index 0c23a7a2..49f9e8af 100644
> --- a/libsepol/src/policydb.c
> +++ b/libsepol/src/policydb.c
> @@ -1126,7 +1126,7 @@ static int cat_index(hashtab_key_t key, hashtab_datum_t datum, void *datap)
>         return 0;
>  }
>
> -static int (*index_f[SYM_NUM]) (hashtab_key_t key, hashtab_datum_t datum,
> +static int (*const index_f[SYM_NUM]) (hashtab_key_t key, hashtab_datum_t datum,
>                                 void *datap) = {
>  common_index, class_index, role_index, type_index, user_index,
>             cond_index_bool, sens_index, cat_index,};
> @@ -1409,7 +1409,7 @@ static int cat_destroy(hashtab_key_t key, hashtab_datum_t datum, void *p
>         return 0;
>  }
>
> -static int (*destroy_f[SYM_NUM]) (hashtab_key_t key, hashtab_datum_t datum,
> +static int (*const destroy_f[SYM_NUM]) (hashtab_key_t key, hashtab_datum_t datum,
>                                   void *datap) = {
>  common_destroy, class_destroy, role_destroy, type_destroy, user_destroy,
>             cond_destroy_bool, sens_destroy, cat_destroy,};
> @@ -3410,7 +3410,7 @@ static int cat_read(policydb_t * p
>         return -1;
>  }
>
> -static int (*read_f[SYM_NUM]) (policydb_t * p, hashtab_t h,
> +static int (*const read_f[SYM_NUM]) (policydb_t * p, hashtab_t h,
>                                struct policy_file * fp) = {
>  common_read, class_read, role_read, type_read, user_read,
>             cond_read_bool, sens_read, cat_read,};
> --
> 2.43.0
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] libsepol: constify function pointer arrays
  2024-04-03 19:51 ` James Carter
@ 2024-04-04 16:23   ` James Carter
  0 siblings, 0 replies; 3+ messages in thread
From: James Carter @ 2024-04-04 16:23 UTC (permalink / raw
  To: Christian Göttsche; +Cc: selinux, Christian Göttsche

On Wed, Apr 3, 2024 at 3:51 PM James Carter <jwcart2@gmail.com> wrote:
>
> On Tue, Apr 2, 2024 at 11:46 AM Christian Göttsche
> <cgoettsche@seltendoof.de> wrote:
> >
> > From: Christian Göttsche <cgzones@googlemail.com>
> >
> > The function pointer arrays are never changed, declare them const.
> >
> > Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
>
> Acked-by: James Carter <jwcart2@gmail.com>
>

Merged.
Thanks,
Jim

> > ---
> >  libsepol/src/policydb.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/libsepol/src/policydb.c b/libsepol/src/policydb.c
> > index 0c23a7a2..49f9e8af 100644
> > --- a/libsepol/src/policydb.c
> > +++ b/libsepol/src/policydb.c
> > @@ -1126,7 +1126,7 @@ static int cat_index(hashtab_key_t key, hashtab_datum_t datum, void *datap)
> >         return 0;
> >  }
> >
> > -static int (*index_f[SYM_NUM]) (hashtab_key_t key, hashtab_datum_t datum,
> > +static int (*const index_f[SYM_NUM]) (hashtab_key_t key, hashtab_datum_t datum,
> >                                 void *datap) = {
> >  common_index, class_index, role_index, type_index, user_index,
> >             cond_index_bool, sens_index, cat_index,};
> > @@ -1409,7 +1409,7 @@ static int cat_destroy(hashtab_key_t key, hashtab_datum_t datum, void *p
> >         return 0;
> >  }
> >
> > -static int (*destroy_f[SYM_NUM]) (hashtab_key_t key, hashtab_datum_t datum,
> > +static int (*const destroy_f[SYM_NUM]) (hashtab_key_t key, hashtab_datum_t datum,
> >                                   void *datap) = {
> >  common_destroy, class_destroy, role_destroy, type_destroy, user_destroy,
> >             cond_destroy_bool, sens_destroy, cat_destroy,};
> > @@ -3410,7 +3410,7 @@ static int cat_read(policydb_t * p
> >         return -1;
> >  }
> >
> > -static int (*read_f[SYM_NUM]) (policydb_t * p, hashtab_t h,
> > +static int (*const read_f[SYM_NUM]) (policydb_t * p, hashtab_t h,
> >                                struct policy_file * fp) = {
> >  common_read, class_read, role_read, type_read, user_read,
> >             cond_read_bool, sens_read, cat_read,};
> > --
> > 2.43.0
> >
> >

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-04-04 16:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-02 15:42 [PATCH] libsepol: constify function pointer arrays Christian Göttsche
2024-04-03 19:51 ` James Carter
2024-04-04 16:23   ` James Carter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).