[vlc-commits] egl: use helper function vlc_gl_StrHasToken

Zhao Zhili git at videolan.org
Wed May 23 17:33:40 CEST 2018


vlc | branch: master | Zhao Zhili <quinkblack at foxmail.com> | Wed May 23 19:51:06 2018 +0800| [323e604d885607009b31687831cf40bdee4e61ea] | committer: Thomas Guillem

egl: use helper function vlc_gl_StrHasToken

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=323e604d885607009b31687831cf40bdee4e61ea
---

 modules/video_output/opengl/egl.c | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/modules/video_output/opengl/egl.c b/modules/video_output/opengl/egl.c
index 4543f2d66a..3cfc3f41c3 100644
--- a/modules/video_output/opengl/egl.c
+++ b/modules/video_output/opengl/egl.c
@@ -123,33 +123,16 @@ static bool DestroyImageKHR(vlc_gl_t *gl, void *image)
     return sys->eglDestroyImageKHR(sys->display, image);
 }
 
-static bool CheckToken(const char *haystack, const char *needle)
-{
-    size_t len = strlen(needle);
-
-    while (haystack != NULL)
-    {
-        while (*haystack == ' ')
-            haystack++;
-        if (!strncmp(haystack, needle, len)
-         && (memchr(" ", haystack[len], 2) != NULL))
-            return true;
-
-        haystack = strchr(haystack, ' ');
-    }
-    return false;
-}
-
 static bool CheckAPI (EGLDisplay dpy, const char *api)
 {
     const char *apis = eglQueryString (dpy, EGL_CLIENT_APIS);
-    return CheckToken(apis, api);
+    return vlc_gl_StrHasToken(apis, api);
 }
 
 static bool CheckClientExt(const char *name)
 {
     const char *exts = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
-    return CheckToken(exts, name);
+    return vlc_gl_StrHasToken(exts, name);
 }
 
 struct gl_api



More information about the vlc-commits mailing list