[Mesa-dev] [PATCH 29/41] glapi: gl_XML.py: refactor out extra else statement
Ian Romanick
idr at freedesktop.org
Tue Apr 19 23:28:09 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 is a pretty minor refactor, but it avoids having an else statement
> with a nested if. It instead makes it one big if statement.
>
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> ---
> src/mapi/glapi/gen/gl_XML.py | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/src/mapi/glapi/gen/gl_XML.py b/src/mapi/glapi/gen/gl_XML.py
> index 2ce6e5d..561a86f 100644
> --- a/src/mapi/glapi/gen/gl_XML.py
> +++ b/src/mapi/glapi/gen/gl_XML.py
> @@ -273,8 +273,8 @@ def classify_category(name, number):
> 1. ARB extensions, sorted by extension number.
> 2. Non-ARB extensions, sorted by extension number.
> 3. Un-numbered extensions, sorted by extension name.
> - """
>
> + """
> try:
> core_version = float(name)
> except (ValueError, TypeError):
> @@ -286,13 +286,12 @@ def classify_category(name, number):
> elif name.startswith("GL_ARB_") or name.startswith("GLX_ARB_") or name.startswith("WGL_ARB_"):
> cat_type = 1
> key = int(number)
> + elif number is not None:
> + cat_type = 2
> + key = int(number)
> else:
> - if number != None:
> - cat_type = 2
> - key = int(number)
> - else:
> - cat_type = 3
> - key = name
> + cat_type = 3
> + key = name
>
> return [cat_type, key]
>
>
More information about the mesa-dev
mailing list