1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-09-15 04:08:07 -04:00

Remove unused function

This commit is contained in:
Moritz Grimm 2017-09-25 17:47:12 +02:00
parent cb997e549c
commit ddc30688e6
2 changed files with 0 additions and 52 deletions

View File

@ -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 <url>: not an HTTP address");
return (0);
}
p1 = url + strlen("http://");
p2 = strchr(p1, ':');
if (p2 == NULL) {
log_error("invalid <url>: missing port");
return (0);
}
hostsiz = (p2 - p1) + 1;
if (hostsiz <= 1) {
log_error("invalid <url>: 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 <url>: 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 <url>: port: %s is %s", tmpPort, errstr);
xfree(*hostname);
return (0);
}
mountsiz = strlen(p3) + 1;
*mountname = xmalloc(mountsiz);
strlcpy(*mountname, p3, mountsiz);
return (1);
}

View File

@ -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__ */