diff options
author | Volker Lendecke <vl@samba.org> | 2017-08-02 17:32:50 +0200 |
---|---|---|
committer | Ralph Boehme <slow@samba.org> | 2017-11-29 16:59:15 +0100 |
commit | 8e824ad69700412cedeb758029fdad4d1b5c6bbe (patch) | |
tree | 55a77c5965bae595a41f8dae360a3eee92445d52 /lib | |
parent | 805ae8a4f1fe61cb44000c2967f61e3bffa08eca (diff) | |
download | samba-8e824ad69700412cedeb758029fdad4d1b5c6bbe.tar.gz |
lib: Only call strlen if necessary in strv
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/util/strv.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/util/strv.c b/lib/util/strv.c index 864a3e5cf8b..328f561722b 100644 --- a/lib/util/strv.c +++ b/lib/util/strv.c @@ -79,7 +79,9 @@ static bool strv_valid_entry(const char *strv, size_t strv_len, return false; } - *entry_len = strlen(entry); + if (entry_len != NULL) { + *entry_len = strlen(entry); + } return true; } @@ -91,7 +93,7 @@ char *strv_next(char *strv, const char *entry) char *result; if (entry == NULL) { - if (strv_valid_entry(strv, len, strv, &entry_len)) { + if (strv_valid_entry(strv, len, strv, NULL)) { return strv; } return NULL; |