mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-02 15:25:27 +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:
@@ -109,14 +109,13 @@ bool atomic_dec_and_test(unsigned int *v)
|
|||||||
|
|
||||||
int _aa_is_blacklisted(const char *name, const char *path)
|
int _aa_is_blacklisted(const char *name, const char *path)
|
||||||
{
|
{
|
||||||
int name_len;
|
size_t name_len = strlen(name);
|
||||||
struct ignored_suffix_t *suffix;
|
struct ignored_suffix_t *suffix;
|
||||||
|
|
||||||
/* skip dot files and files with no name */
|
/* skip dot files and files with no name */
|
||||||
if (!strlen(name) || *name == '.')
|
if (!name_len || *name == '.')
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
name_len = strlen(name);
|
|
||||||
/* skip blacklisted suffixes */
|
/* skip blacklisted suffixes */
|
||||||
for (suffix = ignored_suffixes; suffix->text; suffix++) {
|
for (suffix = ignored_suffixes; suffix->text; suffix++) {
|
||||||
char *found;
|
char *found;
|
||||||
|
Reference in New Issue
Block a user