Skip to content

Commit

Permalink
libsepol: mark read-only parameters of type_set_ interfaces const
Browse files Browse the repository at this point in the history
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@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
  • Loading branch information
cgzones authored and jwcart2 committed Jun 24, 2021
1 parent 390ec54 commit 8eec1bb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions libsepol/include/sepol/policydb/policydb.h
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions libsepol/src/policydb.c
Expand Up @@ -1747,7 +1747,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);

Expand All @@ -1764,7 +1764,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);

Expand All @@ -1777,7 +1777,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;
Expand Down

0 comments on commit 8eec1bb

Please sign in to comment.