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>
diff --git a/shared/platform.h b/shared/platform.h
index b1b9128..77c8259 100644
--- a/shared/platform.h
+++ b/shared/platform.h
@@ -55,6 +55,34 @@
 								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)
 {