From: Amos Jeffries Date: Fri, 31 Jul 2015 00:16:40 +0000 (-0700) Subject: Cleanup: urlParseProtocol() is unused outside url.cc X-Git-Tag: merge-candidate-3-v1~12^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5a7fb80ae92b27a09f0b74fa9ba414589934d31d;p=thirdparty%2Fsquid.git Cleanup: urlParseProtocol() is unused outside url.cc --- diff --git a/src/URL.h b/src/URL.h index f13df3de3e..3c1b1933cb 100644 --- a/src/URL.h +++ b/src/URL.h @@ -140,7 +140,6 @@ operator <<(std::ostream &os, const URL &url) class HttpRequest; class HttpRequestMethod; -AnyP::ProtocolType urlParseProtocol(const char *, const char *e = NULL); void urlInitialize(void); HttpRequest *urlParse(const HttpRequestMethod&, char *, HttpRequest *request = NULL); char *urlCanonicalClean(const HttpRequest *); diff --git a/src/url.cc b/src/url.cc index 0e8e58c981..7a22ea58e6 100644 --- a/src/url.cc +++ b/src/url.cc @@ -112,22 +112,14 @@ urlInitialize(void) } /** - * urlParseProtocol() takes begin (b) and end (e) pointers, but for - * backwards compatibility, e defaults to NULL, in which case we - * assume b is NULL-terminated. + * Parse the scheme name from string b, into protocol type. + * The string must be 0-terminated. */ AnyP::ProtocolType -urlParseProtocol(const char *b, const char *e) +urlParseProtocol(const char *b) { - /* - * if e is NULL, b must be NULL terminated and we - * make e point to the first whitespace character - * after b. - */ - - if (NULL == e) - e = b + strcspn(b, ":"); - + // make e point to the ':' character + const char *e = b + strcspn(b, ":"); int len = e - b; /* test common stuff first */