[Mesa-dev] [PATCH 21/41] glapi: gl_XML.py: simplify gl_api.functionIterateByOffset
Ian Romanick
idr at freedesktop.org
Tue Apr 19 22:15:42 UTC 2016
That's much better. This patch is
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
On 03/31/2016 05:04 PM, Dylan Baker wrote:
> Use the max function and a generator expression instead of a loop and
> if. This is certainly no less efficient, and saves several lines of
> code.
>
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> ---
> src/mapi/glapi/gen/gl_XML.py | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/src/mapi/glapi/gen/gl_XML.py b/src/mapi/glapi/gen/gl_XML.py
> index b7178d6..f96e44a 100644
> --- a/src/mapi/glapi/gen/gl_XML.py
> +++ b/src/mapi/glapi/gen/gl_XML.py
> @@ -938,10 +938,7 @@ class gl_api(object):
> return iter(functions)
>
> def functionIterateByOffset(self):
> - max_offset = -1
> - for func in self.functions_by_name.itervalues():
> - if func.offset > max_offset:
> - max_offset = func.offset
> + max_offset = max(f.offset for f in self.functions_by_name.itervalues())
>
> temp = [None for i in range(max_offset + 1)]
> for func in self.functions_by_name.itervalues():
>
More information about the mesa-dev
mailing list