2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-29 05:17:59 +00:00

libapparmor: Store the string len instead of calling strlen() twice

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
This commit is contained in:
Tyler Hicks 2015-06-15 23:58:40 -05:00
parent 3e80c75f57
commit 42a66e64ee

View File

@ -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;