diff options
author | Max Kellermann <max@duempel.org> | 2013-12-15 17:05:18 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-12-15 17:06:10 +0100 |
commit | e1ec65bd53db811bfc66d92346519c43a06b65c7 (patch) | |
tree | ad00fa0b711feefde3ab68c34a77c6f3298e7f83 /src/util/UriUtil.cxx | |
parent | 65b8e52d802fa42fcdd95457cfc2ecc8ecbc3793 (diff) | |
download | mpd-e1ec65bd53db811bfc66d92346519c43a06b65c7.tar.gz mpd-e1ec65bd53db811bfc66d92346519c43a06b65c7.tar.xz mpd-e1ec65bd53db811bfc66d92346519c43a06b65c7.zip |
UriUtil: add function uri_get_scheme()
Replaces g_uri_parse_scheme().
Diffstat (limited to '')
-rw-r--r-- | src/util/UriUtil.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/util/UriUtil.cxx b/src/util/UriUtil.cxx index 7997bd5c9..89d2a473a 100644 --- a/src/util/UriUtil.cxx +++ b/src/util/UriUtil.cxx @@ -27,6 +27,16 @@ bool uri_has_scheme(const char *uri) return strstr(uri, "://") != nullptr; } +std::string +uri_get_scheme(const char *uri) +{ + const char *end = strstr(uri, "://"); + if (end == nullptr) + end = uri; + + return std::string(uri, end); +} + /* suffixes should be ascii only characters */ const char * uri_get_suffix(const char *uri) |