From ddc30688e6261dbb9a3e1ba8abf0828399f52e38 Mon Sep 17 00:00:00 2001 From: Moritz Grimm Date: Mon, 25 Sep 2017 17:47:12 +0200 Subject: [PATCH] Remove unused function --- src/util.c | 51 --------------------------------------------------- src/util.h | 1 - 2 files changed, 52 deletions(-) diff --git a/src/util.c b/src/util.c index e0affd9..6de0727 100644 --- a/src/util.c +++ b/src/util.c @@ -341,54 +341,3 @@ util_shellquote(const char *in, size_t outlen_max) return (out); } - -int -util_urlparse(const char *url, char **hostname, unsigned short *port, - char **mountname) -{ - const char *p1, *p2, *p3; - char tmpPort[6] = ""; - size_t hostsiz, mountsiz; - const char *errstr; - - if (strncmp(url, "http://", strlen("http://")) != 0) { - log_error("invalid : not an HTTP address"); - return (0); - } - - p1 = url + strlen("http://"); - p2 = strchr(p1, ':'); - if (p2 == NULL) { - log_error("invalid : missing port"); - return (0); - } - hostsiz = (p2 - p1) + 1; - if (hostsiz <= 1) { - log_error("invalid : missing host"); - return (0); - } - *hostname = xmalloc(hostsiz); - strlcpy(*hostname, p1, hostsiz); - - p2++; - p3 = strchr(p2, '/'); - if (p3 == NULL || p3 - p2 >= (int)sizeof(tmpPort)) { - log_error("invalid : mountpoint missing, or port number too long"); - xfree(*hostname); - return (0); - } - - strlcpy(tmpPort, p2, (p3 - p2) + 1UL); - *port = (unsigned short)strtonum(tmpPort, 1LL, (long long)USHRT_MAX, &errstr); - if (errstr) { - log_error("invalid : port: %s is %s", tmpPort, errstr); - xfree(*hostname); - return (0); - } - - mountsiz = strlen(p3) + 1; - *mountname = xmalloc(mountsiz); - strlcpy(*mountname, p3, mountsiz); - - return (1); -} diff --git a/src/util.h b/src/util.h index 9daee56..25cc17c 100644 --- a/src/util.h +++ b/src/util.h @@ -28,6 +28,5 @@ char * util_char2utf8(const char *); char * util_utf82char(const char *); char * util_expand_words(const char *, struct util_dict[]); char * util_shellquote(const char *, size_t); -int util_urlparse(const char *, char **, unsigned short *, char **); #endif /* __UTIL_H__ */