common: fix compilation when strnlen, strnup and memrchr are not available
[lttng-tools.git] / src / common / compat / string.h
index c9aa7f7fa099e3575b9a565176768a6bf6c4b134..fd4f2f021c38c29e7df97567270e3b103cbff0b6 100644 (file)
@@ -25,7 +25,7 @@ size_t lttng_strnlen(const char *str, size_t max)
        size_t ret;
        const char *end;
 
-       end = memchr(str, 0, max);
+       end = (const char *) memchr(str, 0, max);
 
        if (end) {
                ret = (size_t) (end - str);
@@ -61,7 +61,7 @@ char *lttng_strndup(const char *s, size_t n)
                navail = n + 1;
        }
 
-       ret = malloc(navail);
+       ret = (char *) malloc(navail);
        if (!ret) {
                goto end;
        }
@@ -120,7 +120,7 @@ static inline
 void *lttng_memrchr(const void *s, int c, size_t n)
 {
        int i;
-       const char *str = s;
+       const char *str = (const char *) s;
        for (i = n-1; i >= 0; i--) {
                if (str[i] == (char)c) {
                        return (void *)(str+i);
This page took 0.023949 seconds and 4 git commands to generate.