[PATCH weston 2/3] compositor: add fallback strchrnul()
Pekka Paalanen
ppaalanen at gmail.com
Tue Jun 12 07:42:25 PDT 2012
Android does not have this function.
Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
---
configure.ac | 2 +-
shared/os-compatibility.c | 10 ++++++++++
shared/os-compatibility.h | 5 +++++
3 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/configure.ac b/configure.ac
index 7dbd9f9..ce97486 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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])
diff --git a/shared/os-compatibility.c b/shared/os-compatibility.c
index 66934a8..21d4d02 100644
--- a/shared/os-compatibility.c
+++ b/shared/os-compatibility.c
@@ -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
diff --git a/shared/os-compatibility.h b/shared/os-compatibility.h
index b2021f1..c1edcfb 100644
--- a/shared/os-compatibility.h
+++ b/shared/os-compatibility.h
@@ -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 */
--
1.7.3.4
More information about the wayland-devel
mailing list