mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
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
@ -135,9 +135,15 @@ static int curl_gethost(const char *url, char *buffer)
|
||||
p += 2; /* jump over the found // */
|
||||
hostlen = strcspn(p, "/");
|
||||
|
||||
/* there might be a user:pass@ on the URL. hide it. */
|
||||
q = memrchr(p, '@', hostlen);
|
||||
if(q) {
|
||||
/* there might be a user:pass@ on the URL. hide it. avoid using memrchr()
|
||||
* for portability concerns. */
|
||||
q = p + hostlen;
|
||||
while(--q > p) {
|
||||
if(*q == '@') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(*q == '@' && p != q) {
|
||||
hostlen -= q - p + 1;
|
||||
p = q + 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user