From 07e89c1e5db2769c1128f5d99fead151a4afc751 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sun, 18 Sep 2011 17:22:18 -0400 Subject: 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 --- lib/libalpm/dload.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/libalpm') diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index e786a3c0..6f0139d1 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -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; } -- cgit v1.2.3-70-g09d2