diff mbox series

libsepol/cil: make array cil_sym_sizes const

Message ID 20210626123443.12149-1-nicolas.iooss@m4x.org (mailing list archive)
State Accepted
Headers show
Series libsepol/cil: make array cil_sym_sizes const | expand

Commit Message

Nicolas Iooss June 26, 2021, 12:34 p.m. UTC
The values of this table are never modified.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
---
 libsepol/cil/src/cil.c          | 4 ++--
 libsepol/cil/src/cil_internal.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

James Carter June 28, 2021, 8:23 p.m. UTC | #1
On Sat, Jun 26, 2021 at 8:35 AM Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
>
> The values of this table are never modified.
>
> Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>

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

> ---
>  libsepol/cil/src/cil.c          | 4 ++--
>  libsepol/cil/src/cil_internal.h | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/libsepol/cil/src/cil.c b/libsepol/cil/src/cil.c
> index 9d5038d91add..32e8b3cf419e 100644
> --- a/libsepol/cil/src/cil.c
> +++ b/libsepol/cil/src/cil.c
> @@ -52,7 +52,7 @@
>  #include "cil_strpool.h"
>  #include "cil_write_ast.h"
>
> -int cil_sym_sizes[CIL_SYM_ARRAY_NUM][CIL_SYM_NUM] = {
> +const int cil_sym_sizes[CIL_SYM_ARRAY_NUM][CIL_SYM_NUM] = {
>         {64, 64, 64, 1 << 13, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64},
>         {8, 8, 8, 32, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
>         {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
> @@ -1882,7 +1882,7 @@ void cil_set_policy_version(struct cil_db *db, int policy_version)
>         db->policy_version = policy_version;
>  }
>
> -void cil_symtab_array_init(symtab_t symtab[], int symtab_sizes[CIL_SYM_NUM])
> +void cil_symtab_array_init(symtab_t symtab[], const int symtab_sizes[CIL_SYM_NUM])
>  {
>         uint32_t i = 0;
>         for (i = 0; i < CIL_SYM_NUM; i++) {
> diff --git a/libsepol/cil/src/cil_internal.h b/libsepol/cil/src/cil_internal.h
> index 8b9aeabf66e4..3211fc355ec9 100644
> --- a/libsepol/cil/src/cil_internal.h
> +++ b/libsepol/cil/src/cil_internal.h
> @@ -275,7 +275,7 @@ enum cil_sym_array {
>         CIL_SYM_ARRAY_NUM
>  };
>
> -extern int cil_sym_sizes[CIL_SYM_ARRAY_NUM][CIL_SYM_NUM];
> +extern const int cil_sym_sizes[CIL_SYM_ARRAY_NUM][CIL_SYM_NUM];
>
>  #define CIL_CLASS_SYM_SIZE     256
>  #define CIL_PERMS_PER_CLASS (sizeof(sepol_access_vector_t) * 8)
> @@ -981,7 +981,7 @@ int cil_userprefixes_to_string(struct cil_db *db, char **out, size_t *size);
>  int cil_selinuxusers_to_string(struct cil_db *db, char **out, size_t *size);
>  int cil_filecons_to_string(struct cil_db *db, char **out, size_t *size);
>
> -void cil_symtab_array_init(symtab_t symtab[], int symtab_sizes[CIL_SYM_NUM]);
> +void cil_symtab_array_init(symtab_t symtab[], const int symtab_sizes[CIL_SYM_NUM]);
>  void cil_symtab_array_destroy(symtab_t symtab[]);
>  void cil_destroy_ast_symtabs(struct cil_tree_node *root);
>  int cil_get_symtab(struct cil_tree_node *ast_node, symtab_t **symtab, enum cil_sym_index sym_index);
> --
> 2.32.0
>
Nicolas Iooss June 30, 2021, 7:45 p.m. UTC | #2
On Mon, Jun 28, 2021 at 10:23 PM James Carter <jwcart2@gmail.com> wrote:
>
> On Sat, Jun 26, 2021 at 8:35 AM Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
> >
> > The values of this table are never modified.
> >
> > Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
>
> Acked-by: James Carter <jwcart2@gmail.com>

Applied. Thanks!

Nicolas

> > ---
> >  libsepol/cil/src/cil.c          | 4 ++--
> >  libsepol/cil/src/cil_internal.h | 4 ++--
> >  2 files changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/libsepol/cil/src/cil.c b/libsepol/cil/src/cil.c
> > index 9d5038d91add..32e8b3cf419e 100644
> > --- a/libsepol/cil/src/cil.c
> > +++ b/libsepol/cil/src/cil.c
> > @@ -52,7 +52,7 @@
> >  #include "cil_strpool.h"
> >  #include "cil_write_ast.h"
> >
> > -int cil_sym_sizes[CIL_SYM_ARRAY_NUM][CIL_SYM_NUM] = {
> > +const int cil_sym_sizes[CIL_SYM_ARRAY_NUM][CIL_SYM_NUM] = {
> >         {64, 64, 64, 1 << 13, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64},
> >         {8, 8, 8, 32, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
> >         {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
> > @@ -1882,7 +1882,7 @@ void cil_set_policy_version(struct cil_db *db, int policy_version)
> >         db->policy_version = policy_version;
> >  }
> >
> > -void cil_symtab_array_init(symtab_t symtab[], int symtab_sizes[CIL_SYM_NUM])
> > +void cil_symtab_array_init(symtab_t symtab[], const int symtab_sizes[CIL_SYM_NUM])
> >  {
> >         uint32_t i = 0;
> >         for (i = 0; i < CIL_SYM_NUM; i++) {
> > diff --git a/libsepol/cil/src/cil_internal.h b/libsepol/cil/src/cil_internal.h
> > index 8b9aeabf66e4..3211fc355ec9 100644
> > --- a/libsepol/cil/src/cil_internal.h
> > +++ b/libsepol/cil/src/cil_internal.h
> > @@ -275,7 +275,7 @@ enum cil_sym_array {
> >         CIL_SYM_ARRAY_NUM
> >  };
> >
> > -extern int cil_sym_sizes[CIL_SYM_ARRAY_NUM][CIL_SYM_NUM];
> > +extern const int cil_sym_sizes[CIL_SYM_ARRAY_NUM][CIL_SYM_NUM];
> >
> >  #define CIL_CLASS_SYM_SIZE     256
> >  #define CIL_PERMS_PER_CLASS (sizeof(sepol_access_vector_t) * 8)
> > @@ -981,7 +981,7 @@ int cil_userprefixes_to_string(struct cil_db *db, char **out, size_t *size);
> >  int cil_selinuxusers_to_string(struct cil_db *db, char **out, size_t *size);
> >  int cil_filecons_to_string(struct cil_db *db, char **out, size_t *size);
> >
> > -void cil_symtab_array_init(symtab_t symtab[], int symtab_sizes[CIL_SYM_NUM]);
> > +void cil_symtab_array_init(symtab_t symtab[], const int symtab_sizes[CIL_SYM_NUM]);
> >  void cil_symtab_array_destroy(symtab_t symtab[]);
> >  void cil_destroy_ast_symtabs(struct cil_tree_node *root);
> >  int cil_get_symtab(struct cil_tree_node *ast_node, symtab_t **symtab, enum cil_sym_index sym_index);
> > --
> > 2.32.0
> >
diff mbox series

Patch

diff --git a/libsepol/cil/src/cil.c b/libsepol/cil/src/cil.c
index 9d5038d91add..32e8b3cf419e 100644
--- a/libsepol/cil/src/cil.c
+++ b/libsepol/cil/src/cil.c
@@ -52,7 +52,7 @@ 
 #include "cil_strpool.h"
 #include "cil_write_ast.h"
 
-int cil_sym_sizes[CIL_SYM_ARRAY_NUM][CIL_SYM_NUM] = {
+const int cil_sym_sizes[CIL_SYM_ARRAY_NUM][CIL_SYM_NUM] = {
 	{64, 64, 64, 1 << 13, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64},
 	{8, 8, 8, 32, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
 	{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
@@ -1882,7 +1882,7 @@  void cil_set_policy_version(struct cil_db *db, int policy_version)
 	db->policy_version = policy_version;
 }
 
-void cil_symtab_array_init(symtab_t symtab[], int symtab_sizes[CIL_SYM_NUM])
+void cil_symtab_array_init(symtab_t symtab[], const int symtab_sizes[CIL_SYM_NUM])
 {
 	uint32_t i = 0;
 	for (i = 0; i < CIL_SYM_NUM; i++) {
diff --git a/libsepol/cil/src/cil_internal.h b/libsepol/cil/src/cil_internal.h
index 8b9aeabf66e4..3211fc355ec9 100644
--- a/libsepol/cil/src/cil_internal.h
+++ b/libsepol/cil/src/cil_internal.h
@@ -275,7 +275,7 @@  enum cil_sym_array {
 	CIL_SYM_ARRAY_NUM
 };
 
-extern int cil_sym_sizes[CIL_SYM_ARRAY_NUM][CIL_SYM_NUM];
+extern const int cil_sym_sizes[CIL_SYM_ARRAY_NUM][CIL_SYM_NUM];
 
 #define CIL_CLASS_SYM_SIZE	256
 #define CIL_PERMS_PER_CLASS (sizeof(sepol_access_vector_t) * 8)
@@ -981,7 +981,7 @@  int cil_userprefixes_to_string(struct cil_db *db, char **out, size_t *size);
 int cil_selinuxusers_to_string(struct cil_db *db, char **out, size_t *size);
 int cil_filecons_to_string(struct cil_db *db, char **out, size_t *size);
 
-void cil_symtab_array_init(symtab_t symtab[], int symtab_sizes[CIL_SYM_NUM]);
+void cil_symtab_array_init(symtab_t symtab[], const int symtab_sizes[CIL_SYM_NUM]);
 void cil_symtab_array_destroy(symtab_t symtab[]);
 void cil_destroy_ast_symtabs(struct cil_tree_node *root);
 int cil_get_symtab(struct cil_tree_node *ast_node, symtab_t **symtab, enum cil_sym_index sym_index);