aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-11-06 09:43:44 +0100
committerMax Kellermann <max@duempel.org>2015-11-06 09:49:22 +0100
commit7640d333f48e4a782e3ea62ac686902ddf155592 (patch)
tree09b639962c2170387b9caf102298a0269a517c24
parentc880099deb41c09ea7844daa27a42dac4142c0cd (diff)
downloadmpd-7640d333f48e4a782e3ea62ac686902ddf155592.tar.gz
mpd-7640d333f48e4a782e3ea62ac686902ddf155592.tar.xz
mpd-7640d333f48e4a782e3ea62ac686902ddf155592.zip
util/UriUtil: make variables more local
-rw-r--r--src/util/UriUtil.cxx11
1 files 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();