Message ID | 20220721152444.31690-2-cgzones@googlemail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | d192e4d937c0 |
Headers | show |
Series | [v2,1/5] libsepol: rename validate_policydb to policydb_validate | expand |
diff --git a/libsepol/include/sepol/policydb/avtab.h b/libsepol/include/sepol/policydb/avtab.h index 10ecde9a..e4c48576 100644 --- a/libsepol/include/sepol/policydb/avtab.h +++ b/libsepol/include/sepol/policydb/avtab.h @@ -112,7 +112,7 @@ extern avtab_datum_t *avtab_search(avtab_t * h, avtab_key_t * k); extern void avtab_destroy(avtab_t * h); -extern int avtab_map(avtab_t * h, +extern int avtab_map(const avtab_t * h, int (*apply) (avtab_key_t * k, avtab_datum_t * d, void *args), void *args); diff --git a/libsepol/src/avtab.c b/libsepol/src/avtab.c index 7920b60a..82fec783 100644 --- a/libsepol/src/avtab.c +++ b/libsepol/src/avtab.c @@ -330,7 +330,7 @@ void avtab_destroy(avtab_t * h) h->mask = 0; } -int avtab_map(avtab_t * h, +int avtab_map(const avtab_t * h, int (*apply) (avtab_key_t * k, avtab_datum_t * d, void *args), void *args) {
The access vector table itself is not modified in avtab_map() thus support passing a const pointer. Logically the content might be changed by the passed callback, but C does not support transitive const-ness well, and C also does not support function overloading, e.g. like for strchr(3). Signed-off-by: Christian Göttsche <cgzones@googlemail.com> --- libsepol/include/sepol/policydb/avtab.h | 2 +- libsepol/src/avtab.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)