[Mesa-dev] [PATCH 27/41] glapi: gl_XML.py: store compiled re as a module variable

Ian Romanick idr at freedesktop.org
Tue Apr 19 23:27:07 UTC 2016


This patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

On 03/31/2016 05:04 PM, Dylan Baker wrote:
> This avoids recompiles of the re each time the function is called.
> 
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> ---
>  src/mapi/glapi/gen/gl_XML.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mapi/glapi/gen/gl_XML.py b/src/mapi/glapi/gen/gl_XML.py
> index a860b0d..73baef6 100644
> --- a/src/mapi/glapi/gen/gl_XML.py
> +++ b/src/mapi/glapi/gen/gl_XML.py
> @@ -38,6 +38,8 @@ import xml.etree.ElementTree as ET
>  import static_data
>  import typeexpr
>  
> +_REAL_CATEGORY_FINDER = re.compile("[1-9][0-9]*[.][0-9]+")
> +
>  
>  def parse_GL_API(file_name, factory=None):
>  
> @@ -252,7 +254,7 @@ def real_function_name(element):
>  
>  
>  def real_category_name(c):
> -    if re.compile("[1-9][0-9]*[.][0-9]+").match(c):
> +    if _REAL_CATEGORY_FINDER.match(c):
>          return "GL_VERSION_" + c.replace(".", "_")
>      else:
>          return c
> 



More information about the mesa-dev mailing list