On Mon, 28 May 2018 09:59:43 +0200 Olivier Fourdan <four...@gmail.com> wrote:
> Hi Pekka, > > On 28 May 2018 at 09:24, Pekka Paalanen <ppaala...@gmail.com> wrote: > > > do not use strstr() for matching extensions strings. It does a > > sub-string match, which may not be what you want. What if there was an > > extension called "platform_gbm_unixmem" or such? > > > > The substring match is what we want though, as the extension is one of the > multiple extensions in the string, and using strstr() seems to be a fairly > common practice (in glamor, glx and elsewhere, this is what is in the > documentation for EGL_MESA_platform_gbm [1] for example) Yes, it is very common to have a faulty extension string matching code, because extension names that could be mismatched are fairly rare, and even when they are susceptible, you would need to have the wrong one and not the right one to actually notice. The example in [1] is broken too. https://cgit.freedesktop.org/wayland/weston/tree/shared/platform.h#n46 has an example of a better matching function. For rationale, see: https://cgit.freedesktop.org/wayland/weston/commit/?id=cc3a192b448153a7911d44aa0fa549099607911d > > But yes, you're right, checking for the complete extension name > "EGL_MESA_platform_gbm" might be preferable here. That will still hit a false positive if an extension called, say, EGL_MESA_platform_gbmeta is ever created and advertised. Thanks, pq > > Cheers, > Olivier. > > [1] > https://www.khronos.org/registry/EGL/extensions/MESA/EGL_MESA_platform_gbm.txt
pgpF_UpJJFLPL.pgp
Description: OpenPGP digital signature
_______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel