[vlc-devel] [PATCH 2/2] egl: use helper function vlc_gl_StrHasToken

Zhao Zhili quinkblack at foxmail.com
Wed May 23 13:51:06 CEST 2018


---
 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 4543f2d..3cfc3f4 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
-- 
2.9.5






More information about the vlc-devel mailing list