[vlc-commits] cookies: avoid overkill strlen()
Rémi Denis-Courmont
git at videolan.org
Wed Sep 7 21:18:36 CEST 2016
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Sep 7 22:17:19 2016 +0300| [baf15ab94dd6212c37f19c9fba3fd77224d76c1a] | committer: Rémi Denis-Courmont
cookies: avoid overkill strlen()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=baf15ab94dd6212c37f19c9fba3fd77224d76c1a
---
src/misc/httpcookies.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/misc/httpcookies.c b/src/misc/httpcookies.c
index 4650f91..e1d6e37 100644
--- a/src/misc/httpcookies.c
+++ b/src/misc/httpcookies.c
@@ -188,7 +188,7 @@ static bool cookie_should_be_sent(const http_cookie_t *cookie, bool secure,
static bool cookie_is_valid(const http_cookie_t * cookie, bool secure,
const char *host, const char *path)
{
- return cookie && cookie->psz_name && strlen(cookie->psz_name) > 0 &&
+ return cookie && cookie->psz_name && cookie->psz_name[0] != '\0' &&
cookie->psz_domain &&
!cookie_domain_is_public_suffix(cookie->psz_domain) &&
cookie_domain_matches(cookie, host);
@@ -291,7 +291,7 @@ static http_cookie_t *cookie_parse(const char *value,
}
cookie->psz_domain = cookie_get_domain(value);
- if ( cookie->psz_domain == NULL || strlen(cookie->psz_domain) == 0 )
+ if( cookie->psz_domain == NULL || cookie->psz_domain[0] == '\0' )
{
free(cookie->psz_domain);
cookie->psz_domain = strdup(host);
@@ -301,7 +301,7 @@ static http_cookie_t *cookie_parse(const char *value,
cookie->b_host_only = false;
cookie->psz_path = cookie_get_attribute_value(value, "path" );
- if ( cookie->psz_path == NULL || strlen(cookie->psz_path) == 0 )
+ if( cookie->psz_path == NULL || cookie->psz_path[0] == '\0' )
{
free(cookie->psz_path);
cookie->psz_path = cookie_default_path(path);
More information about the vlc-commits
mailing list