From 8eec1bb50230c78faaeb9ccc0decb83cad205bf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Tue, 8 Jun 2021 17:59:00 +0200 Subject: [PATCH] libsepol: mark read-only parameters of type_set_ interfaces const MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Acked-by: James Carter --- 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 9ef43abc..6976ef48 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 e0b072e1..b4e427af 100644 --- a/libsepol/src/policydb.c +++ b/libsepol/src/policydb.c @@ -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); @@ -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); @@ -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;