gl-renderer: move check_extension() to shared/
... prefixing it with a "weston_". This way we can reuse it across the board, instead of the current strstr. The latter of which can give us false positives, thus it will be resolved with next commit(s). Signed-off-by: Emil Velikov <emil.velikov@collabora.com> Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
committed by
Daniel Stone
parent
cbcf545fd9
commit
f0c3a1c112
@@ -55,6 +55,34 @@ typedef EGLSurface (*PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy,
|
||||
const EGLint *attrib_list);
|
||||
#endif
|
||||
|
||||
static bool
|
||||
weston_check_egl_extension(const char *extensions, const char *extension)
|
||||
{
|
||||
size_t extlen = strlen(extension);
|
||||
const char *end = extensions + strlen(extensions);
|
||||
|
||||
while (extensions < end) {
|
||||
size_t n = 0;
|
||||
|
||||
/* Skip whitespaces, if any */
|
||||
if (*extensions == ' ') {
|
||||
extensions++;
|
||||
continue;
|
||||
}
|
||||
|
||||
n = strcspn(extensions, " ");
|
||||
|
||||
/* Compare strings */
|
||||
if (n == extlen && strncmp(extension, extensions, n) == 0)
|
||||
return true; /* Found */
|
||||
|
||||
extensions += n;
|
||||
}
|
||||
|
||||
/* Not found */
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline void *
|
||||
weston_platform_get_egl_proc_address(const char *address)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user