From 5a7fb80ae92b27a09f0b74fa9ba414589934d31d Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Thu, 30 Jul 2015 17:16:40 -0700 Subject: [PATCH] Cleanup: urlParseProtocol() is unused outside url.cc --- src/URL.h | 1 - src/url.cc | 18 +++++------------- 2 files changed, 5 insertions(+), 14 deletions(-) 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 */ -- 2.47.3