libsepol: optimize inner loop in build_type_map()

Only attributes can be a superset of another attribute, so we can skip
non-attributes right away.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
This commit is contained in:
Ondrej Mosnacek 2020-02-27 17:02:56 +01:00 committed by James Carter
parent cc0425f349
commit df2a9f40c2

View File

@ -50,6 +50,9 @@ static ebitmap_t *build_type_map(const policydb_t *p)
for (k = 0; k < p->p_types.nprim; k++) {
ebitmap_t *types_k = &p->attr_type_map[k];
if (p->type_val_to_struct[k]->flavor != TYPE_ATTRIB)
continue;
if (ebitmap_contains(types_k, types_i)) {
if (ebitmap_set_bit(&map[i], k, 1))
goto err;