Move it from piglit-framework-gl.h to piglit-util.h. This is a generic utility that should not be restricted GL tests.
Signed-off-by: Chad Versace <[email protected]> --- tests/util/piglit-framework-gl.c | 18 ------------------ tests/util/piglit-framework-gl.h | 1 - tests/util/piglit-util.c | 22 ++++++++++++++++++++++ tests/util/piglit-util.h | 3 +++ 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/tests/util/piglit-framework-gl.c b/tests/util/piglit-framework-gl.c index 2a315be..d8ab217 100644 --- a/tests/util/piglit-framework-gl.c +++ b/tests/util/piglit-framework-gl.c @@ -178,24 +178,6 @@ piglit_set_reshape_func(void (*func)(int w, int h)) } -/** - * Search for an argument with the given name in the argument list. - * If it is found, remove it and return true. - */ -bool -piglit_strip_arg(int *argc, char *argv[], const char *arg) -{ - int i; - for (i = 1; i < *argc; i++) { - if (!strcmp(argv[i], arg)) { - delete_arg(argv, *argc, i); - *argc -= 1; - return true; - } - } - return false; -} - enum piglit_result piglit_create_dma_buf(unsigned w, unsigned h, unsigned cpp, const void *src_data, unsigned src_stride, diff --git a/tests/util/piglit-framework-gl.h b/tests/util/piglit-framework-gl.h index 7520f38..d4150ae 100644 --- a/tests/util/piglit-framework-gl.h +++ b/tests/util/piglit-framework-gl.h @@ -249,7 +249,6 @@ void piglit_present_results(); void piglit_post_redisplay(void); void piglit_set_keyboard_func(void (*func)(unsigned char key, int x, int y)); void piglit_set_reshape_func(void (*func)(int w, int h)); -bool piglit_strip_arg(int *argc, char *argv[], const char *arg); /** * Convenience macro for invoking piglit_strip_arg() from within diff --git a/tests/util/piglit-util.c b/tests/util/piglit-util.c index 7dd770e..b9d6449 100644 --- a/tests/util/piglit-util.c +++ b/tests/util/piglit-util.c @@ -492,3 +492,25 @@ write_null: va_end(va); return size_written; } + +/** + * Search for an argument with the given name in the argument list. + * If it is found, remove it and return true. + */ +bool +piglit_strip_arg(int *argc, char *argv[], const char *arg) +{ + int i; + for (i = 1; i < *argc; i++) { + if (strcmp(argv[i], arg) != 0) + continue; + + for (i += 1; i < *argc; ++i) + argv[i-1] = argv[i]; + + *argc -= 1; + return true; + } + + return false; +} diff --git a/tests/util/piglit-util.h b/tests/util/piglit-util.h index 0aee833..f021802 100644 --- a/tests/util/piglit-util.h +++ b/tests/util/piglit-util.h @@ -177,6 +177,9 @@ piglit_join_paths(char buf[], size_t buf_size, int n, ...); const char** piglit_split_string_to_array(const char *string, const char *separators); +bool +piglit_strip_arg(int *argc, char *argv[], const char *arg); + #ifdef __cplusplus } /* end extern "C" */ #endif -- 1.8.3.1 _______________________________________________ Piglit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/piglit
