aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/support/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/lib/support/string.c')
-rw-r--r--src/core/lib/support/string.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/lib/support/string.c b/src/core/lib/support/string.c
index f10a30f0fd..f263f82baf 100644
--- a/src/core/lib/support/string.c
+++ b/src/core/lib/support/string.c
@@ -275,3 +275,14 @@ int gpr_stricmp(const char *a, const char *b) {
} while (ca == cb && ca && cb);
return ca - cb;
}
+
+void *gpr_memrchr(const void *s, int c, size_t n) {
+ if (s == NULL) return NULL;
+ char *b = (char *)s;
+ for (size_t i = 0; i < n; i++) {
+ if (b[n - i - 1] == c) {
+ return &b[n - i - 1];
+ }
+ }
+ return NULL;
+}