dload: avoid using memrchr
This function doesn't exist on OSX. Since there aren't any other candidates in alpm for which this function would make sense to use, simply replace the function call with a loop that does the equivalent. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
This commit is contained in:
parent
52c65fdfea
commit
07e89c1e5d
1 changed files with 9 additions and 3 deletions
|
@ -135,9 +135,15 @@ static int curl_gethost(const char *url, char *buffer)
|
||||||
p += 2; /* jump over the found // */
|
p += 2; /* jump over the found // */
|
||||||
hostlen = strcspn(p, "/");
|
hostlen = strcspn(p, "/");
|
||||||
|
|
||||||
/* there might be a user:pass@ on the URL. hide it. */
|
/* there might be a user:pass@ on the URL. hide it. avoid using memrchr()
|
||||||
q = memrchr(p, '@', hostlen);
|
* for portability concerns. */
|
||||||
if(q) {
|
q = p + hostlen;
|
||||||
|
while(--q > p) {
|
||||||
|
if(*q == '@') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(*q == '@' && p != q) {
|
||||||
hostlen -= q - p + 1;
|
hostlen -= q - p + 1;
|
||||||
p = q + 1;
|
p = q + 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue