summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/apk_blob.h4
-rw-r--r--src/blob.c10
2 files changed, 14 insertions, 0 deletions
diff --git a/src/apk_blob.h b/src/apk_blob.h
index 4286fbe..fa307a9 100644
--- a/src/apk_blob.h
+++ b/src/apk_blob.h
@@ -131,4 +131,8 @@ int apk_blob_pull_blob_match(apk_blob_t *b, apk_blob_t match);
extern size_t strlcpy(char *dest, const char *src, size_t size);
#endif
+#if defined(__APPLE__)
+extern void *memrchr(const void *m, int c, size_t n);
+#endif
+
#endif
diff --git a/src/blob.c b/src/blob.c
index 8413a3b..f5d793b 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -156,6 +156,16 @@ int apk_blob_cspn(apk_blob_t blob, const apk_spn_match reject, apk_blob_t *l, ap
}
#endif
+#if defined(__APPLE__)
+void *memrchr(const void *m, int c, size_t n)
+{
+ const unsigned char *s = m;
+ c = (unsigned char)c;
+ while (n--) if (s[n]==c) return (void *)(s+n);
+ return 0;
+}
+#endif
+
int apk_blob_rsplit(apk_blob_t blob, char split, apk_blob_t *l, apk_blob_t *r)
{
char *sep;