aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Gall <tom.gall@linaro.org>2013-02-01 15:50:42 -0600
committerTom Gall <tom.gall@linaro.org>2013-03-25 14:20:18 -0500
commit3f7fcd5ad2b6d2cc0c70d18f0e5377a738ee9efc (patch)
treebeb63ac180cb03fa66d62f315a7adcfae0cb62b4
parente883f26ab70fb195d9730ae671a8c85858bde13b (diff)
android: add strchrnul to shader_runner.c
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.
-rw-r--r--tests/shaders/shader_runner.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 7321d787..7a4369cc 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);