[Piglit] [PATCH 2/2] android: add strchrnul to shader_runner.c
Tom Gall
tom.gall at linaro.org
Fri Feb 1 14:13:32 PST 2013
strchrnul is used in shader_runner.c (and no where else in all
of piglit). Unfortunately bionic, Android's c library does not
include this function. I've writen an implementation of
strchrnul which is only used when compiling for Android.
Signed-off-by: Tom Gall <tom.gall at linaro.org>
---
tests/shaders/shader_runner.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 20f1ee0..fab7296 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -38,6 +38,26 @@
#include "shader_runner_gles_workarounds.h"
+#if defined(__ANDROID__)
+/* on Android there is no strchrnul which is used in this test, so we must fill
+ * in an implementation.
+ *
+ * The strchrnul() function is like strchr() except that if c is not found in s, then
+ * it returns a pointer to the null byte at the end of s, rather than NULL
+ */
+char *
+strchrnul(const char *s, int c)
+{
+ char * result = strchr(s, c);
+
+ if (result == NULL) {
+ result = s + strlen(s);
+ }
+
+ return result;
+}
+#endif /* __ANDROID__ */
+
static void
get_required_versions(const char *script_name,
struct piglit_gl_test_config *config);
--
1.7.10.4
More information about the Piglit
mailing list