From: Michael Orlitzky Date: Fri, 23 Feb 2018 16:39:07 +0000 (-0500) Subject: Remove pointless indirection in acl_entry_count() and acl_is_minimal(). X-Git-Tag: v0.1.0~36 X-Git-Url: https://gitweb.michael.orlitzky.com/?p=apply-default-acl.git;a=commitdiff_plain;h=916bcfd577de83186c26cd4e110b8f750e781054 Remove pointless indirection in acl_entry_count() and acl_is_minimal(). The acl_t type is already a pointer to a structure, so there's no reason to be passing around pointers to acl_t in acl_entry_count() and acl_is_minimal(). This commit changes their signatures and call sites. --- diff --git a/src/apply-default-acl.c b/src/apply-default-acl.c index a3c28fb..022e2b8 100644 --- a/src/apply-default-acl.c +++ b/src/apply-default-acl.c @@ -312,20 +312,20 @@ int acl_set_entry(acl_t* aclp, * @brief Determine the number of entries in the given ACL. * * @param acl - * A pointer to an @c acl_t structure. + * The ACL to inspect. * * @return Either the non-negative number of entries in @c acl, or * @c ACL_ERROR on error. */ -int acl_entry_count(acl_t* acl) { +int acl_entry_count(acl_t acl) { acl_entry_t entry; int entry_count = 0; - int result = acl_get_entry(*acl, ACL_FIRST_ENTRY, &entry); + int result = acl_get_entry(acl, ACL_FIRST_ENTRY, &entry); while (result == ACL_SUCCESS) { entry_count++; - result = acl_get_entry(*acl, ACL_NEXT_ENTRY, &entry); + result = acl_get_entry(acl, ACL_NEXT_ENTRY, &entry); } if (result == ACL_ERROR) { @@ -344,14 +344,14 @@ int acl_entry_count(acl_t* acl) { * An ACL is minimal if it has fewer than four entries. * * @param acl - * A pointer to an acl_t structure. + * The ACL whose minimality is in question. * * @return * - @c ACL_SUCCESS - @c acl is minimal * - @c ACL_FAILURE - @c acl is not minimal * - @c ACL_ERROR - Unexpected library error */ -int acl_is_minimal(acl_t* acl) { +int acl_is_minimal(acl_t acl) { int ec = acl_entry_count(acl); @@ -465,7 +465,7 @@ int any_can_execute_or_dir(const char* path) { /* Our return value. */ int result = ACL_FAILURE; - if (acl_is_minimal(&acl)) { + if (acl_is_minimal(acl)) { mode_t mode = get_mode(path); if (mode & (S_IXUSR | S_IXOTH | S_IXGRP)) { result = ACL_SUCCESS;