compositor: add fallback strchrnul()
authorPekka Paalanen <ppaalanen@gmail.com>
Tue, 12 Jun 2012 14:42:25 +0000 (17:42 +0300)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 12 Jun 2012 16:29:13 +0000 (12:29 -0400)
Android does not have this function.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
configure.ac
shared/os-compatibility.c
shared/os-compatibility.h

index 7dbd9f9..ce97486 100644 (file)
@@ -27,7 +27,7 @@ AC_SUBST(DLOPEN_LIBS)
 
 AC_CHECK_HEADERS([execinfo.h])
 
-AC_CHECK_FUNCS([mkostemp])
+AC_CHECK_FUNCS([mkostemp strchrnul])
 
 PKG_CHECK_MODULES(COMPOSITOR,
                  [wayland-server egl >= 7.10 glesv2 xkbcommon pixman-1])
index 66934a8..21d4d02 100644 (file)
@@ -168,3 +168,13 @@ os_create_anonymous_file(off_t size)
 
        return fd;
 }
+
+#ifndef HAVE_STRCHRNUL
+char *
+strchrnul(const char *s, int c)
+{
+       while (*s && *s != c)
+               s++;
+       return (char *)s;
+}
+#endif
index b2021f1..c1edcfb 100644 (file)
@@ -46,4 +46,9 @@ os_epoll_create_cloexec(void);
 int
 os_create_anonymous_file(off_t size);
 
+#ifndef HAVE_STRCHRNUL
+char *
+strchrnul(const char *s, int c);
+#endif
+
 #endif /* OS_COMPATIBILITY_H */