[Piglit] [PATCH 10/12] util: move string wrapper no piglit-util.h
Emil Velikov
emil.l.velikov at gmail.com
Sat Nov 22 14:40:32 PST 2014
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
tests/shaders/shader_runner.c | 27 ---------------------------
tests/util/piglit-util.h | 27 +++++++++++++++++++++++++++
2 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 107e2b5..e37c07d 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -1133,33 +1133,6 @@ get_required_config(const char *script_name,
}
}
-/**
- * Wrapper for strtod() which also handles +/-inf with MSVC.
- * Note: we only check for "inf" and not "INF".
- */
-static double
-strtod_inf(const char *nptr, char **endptr)
-{
-#if defined(_MSC_VER)
- /* skip spaces and tabs */
- while (*nptr == ' ' || *nptr == '\t')
- nptr++;
-
- if (nptr[0] == 'i' && nptr[1] == 'n' && nptr[2] == 'f') {
- /* +infinity */
- *endptr = (char *) (nptr + 3);
- return INFINITY;
- }
- else if (nptr[0] == '-' && nptr[1] == 'i' && nptr[2] == 'n' && nptr[3] == 'f') {
- /* -infinity */
- *endptr = (char *) (nptr + 4);
- return -INFINITY;
- }
- /* fall-through */
-#endif
- return strtod(nptr, endptr);
-}
-
void
get_floats(const char *line, float *f, unsigned count)
{
diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h
index 441a253..0e0a8b9 100755
--- a/tests/util/piglit-util.h
+++ b/tests/util/piglit-util.h
@@ -174,6 +174,33 @@ streq(const char *a, const char *b)
}
/**
+ * Wrapper for strtod() which also handles +/-inf with MSVC.
+ * Note: we only check for "inf" and not "INF".
+ */
+static inline double
+strtod_inf(const char *nptr, char **endptr)
+{
+#if defined(_MSC_VER)
+ /* skip spaces and tabs */
+ while (*nptr == ' ' || *nptr == '\t')
+ nptr++;
+
+ if (nptr[0] == 'i' && nptr[1] == 'n' && nptr[2] == 'f') {
+ /* +infinity */
+ *endptr = (char *) (nptr + 3);
+ return INFINITY;
+ }
+ else if (nptr[0] == '-' && nptr[1] == 'i' && nptr[2] == 'n' && nptr[3] == 'f') {
+ /* -infinity */
+ *endptr = (char *) (nptr + 4);
+ return -INFINITY;
+ }
+ /* fall-through */
+#endif
+ return strtod(nptr, endptr);
+}
+
+/**
* Determine if an extension is listed in an extension string
*
* \param haystack List of all extensions to be searched
--
2.1.3
More information about the Piglit
mailing list