From 7640d333f48e4a782e3ea62ac686902ddf155592 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 6 Nov 2015 09:43:44 +0100 Subject: util/UriUtil: make variables more local --- src/util/UriUtil.cxx | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/util/UriUtil.cxx b/src/util/UriUtil.cxx index 0782304e3..3f5ae3118 100644 --- a/src/util/UriUtil.cxx +++ b/src/util/UriUtil.cxx @@ -74,8 +74,6 @@ uri_get_suffix(const char *uri, UriSuffixBuffer &buffer) static const char * verify_uri_segment(const char *p) { - const char *q; - unsigned dots = 0; while (*p == '.') { ++p; @@ -85,7 +83,7 @@ verify_uri_segment(const char *p) if (dots <= 2 && (*p == 0 || *p == '/')) return nullptr; - q = strchr(p + 1, '/'); + const char *q = strchr(p + 1, '/'); return q != nullptr ? q : ""; } @@ -109,8 +107,7 @@ uri_safe_local(const char *uri) std::string uri_remove_auth(const char *uri) { - const char *auth, *slash, *at; - + const char *auth; if (memcmp(uri, "http://", 7) == 0) auth = uri + 7; else if (memcmp(uri, "https://", 8) == 0) @@ -121,11 +118,11 @@ uri_remove_auth(const char *uri) /* unrecognized URI */ return std::string(); - slash = strchr(auth, '/'); + const char *slash = strchr(auth, '/'); if (slash == nullptr) slash = auth + strlen(auth); - at = (const char *)memchr(auth, '@', slash - auth); + const char *at = (const char *)memchr(auth, '@', slash - auth); if (at == nullptr) /* no auth info present, do nothing */ return std::string(); -- cgit v1.2.3