[apparmor] [PATCH 2/4] libapparmor: Store the string len instead of calling strlen() twice

Seth Arnold seth.arnold at canonical.com
Tue Jun 16 00:59:31 UTC 2015


On Mon, Jun 15, 2015 at 07:33:14PM -0500, Tyler Hicks wrote:
> Signed-off-by: Tyler Hicks <tyhicks at canonical.com>

Acked-by: Seth Arnold <seth.arnold at canonical.com>

Thanks

> ---
>  libraries/libapparmor/src/private.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/libraries/libapparmor/src/private.c b/libraries/libapparmor/src/private.c
> index d237a0d..abe4017 100644
> --- a/libraries/libapparmor/src/private.c
> +++ b/libraries/libapparmor/src/private.c
> @@ -109,14 +109,13 @@ bool atomic_dec_and_test(unsigned int *v)
>  
>  int _aa_is_blacklisted(const char *name, const char *path)
>  {
> -	int name_len;
> +	size_t name_len = strlen(name);
>  	struct ignored_suffix_t *suffix;
>  
>  	/* skip dot files and files with no name */
> -	if (!strlen(name) || *name == '.')
> +	if (!name_len || *name == '.')
>  		return 1;
>  
> -	name_len = strlen(name);
>  	/* skip blacklisted suffixes */
>  	for (suffix = ignored_suffixes; suffix->text; suffix++) {
>  		char *found;
> -- 
> 2.1.4
> 
> 
> -- 
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20150615/59b002a2/attachment.pgp>


More information about the AppArmor mailing list