summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-09-18 17:22:18 -0400
committerDan McGee <dan@archlinux.org>2011-09-18 16:57:59 -0500
commit07e89c1e5db2769c1128f5d99fead151a4afc751 (patch)
tree342e1d531dc0bccf00c74b1de10ad727b0662189 /lib
parent52c65fdfea7d174ad2f4d895c5783d936fdac7d7 (diff)
downloadpacman-07e89c1e5db2769c1128f5d99fead151a4afc751.tar.xz
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>
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/dload.c12
1 files changed, 9 insertions, 3 deletions
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;
}