[Piglit] [v8 01/13] glapi: fix parsing of extensions containing string "EGL_"

Pohjolainen, Topi topi.pohjolainen at intel.com
Thu Aug 1 22:34:26 PDT 2013


On Wed, Jul 31, 2013 at 02:39:43PM -0700, Chad Versace wrote:
> On 07/10/2013 01:24 AM, Topi Pohjolainen wrote:
> >Category for 'EGLImageTargetTexture2DOES' becomes 'GL_OES_EGL_image'
> >instead of 'GL_OES_Eimage'.
> >
> >Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
> >---
> >  glapi/parse_glspec.py | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> >diff --git a/glapi/parse_glspec.py b/glapi/parse_glspec.py
> >index 9919fce..1d7c5a4 100644
> >--- a/glapi/parse_glspec.py
> >+++ b/glapi/parse_glspec.py
> >@@ -461,9 +461,9 @@ class Api(object):
> >              elif re.match(r'/\* OpenGL ES 3.0 \*/', line):
> >                  category = 'GL_ES_VERSION_3_0'
> >              else:
> >-                m = re.match(r'/\* (GL_.*) \*/', line)
> >+                m = re.match(r'/\*( GL_.*) \*/', line)
> >                  if m:
> >-                    category = m.group(1).replace('GL_', '')
> >+                    category = m.group(1).replace(' GL_', '')
> >
> >              m = re.match(r'GL_APICALL', line)
> >              if m:
> 
> The code's intent is to replace only the first occurrence of 'GL_',
> so let's explicitly do that rather than relying on clever pattern
> matching.

Thanks Chad, I like that a lot better.

> 
> > diff --git a/glapi/parse_glspec.py b/glapi/parse_glspec.py
> > index 9919fce..1d7c5a4 100644
> > --- a/glapi/parse_glspec.py
> > +++ b/glapi/parse_glspec.py
> > @@ -461,9 +461,9 @@ class Api(object):
> >               elif re.match(r'/\* OpenGL ES 3.0 \*/', line):
> >                   category = 'GL_ES_VERSION_3_0'
> >               else:
> >                   m = re.match(r'/\* (GL_.*) \*/', line)
> >                   if m:
> > -                    category = m.group(1).replace('GL_', '')
> > +                    # Replace only first occurrence of 'GL_'.
> > +                    category = m.group(1).replace('GL_', '', 1)
> >
> >               m = re.match(r'GL_APICALL', line)
> >               if m:
> 
> 
> 
> 


More information about the Piglit mailing list