Add utils_expand_path_keep_symlink fonction
[lttng-tools.git] / src / common / compat / string.h
index db3db80522f5fe039f3f5f716f567f6676dfa87f..a7bcab0a8c345a6e34019b2419d424207372be10 100644 (file)
@@ -123,4 +123,25 @@ static inline int lttng_fls(int val)
 }
 #endif /* HAVE_FLS */
 
+#if HAVE_MEMRCHR
+static inline
+void *lttng_memrchr(const void *s, int c, size_t n)
+{
+       return memrchr(s, c, n);
+}
+#else
+static inline
+void *lttng_memrchr(const void *s, int c, size_t n)
+{
+       int i;
+       const char *str = s;
+       for (i = n-1; i >= 0; i--) {
+               if (str[i] == (char)c) {
+                       return (void *)(str+i);
+               }
+       }
+       return NULL;
+}
+#endif /* HAVE_MEMRCHR */
+
 #endif /* _COMPAT_STRING_H */
This page took 0.024303 seconds and 5 git commands to generate.