Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
Ezstream
Commits
ddc30688
Commit
ddc30688
authored
Sep 25, 2017
by
Moritz Grimm
Browse files
Remove unused function
parent
cb997e54
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/util.c
View file @
ddc30688
...
...
@@ -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
);
}
src/util.h
View file @
ddc30688
...
...
@@ -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__ */
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment