[Mesa-dev] [PATCH 1/5] intel/genxml: Convert a not-present-or-"1" dict to a set.
Kenneth Graunke
kenneth at whitecape.org
Wed Sep 20 17:01:41 UTC 2017
On Tuesday, September 19, 2017 11:06:08 AM PDT Eric Anholt wrote:
> I was implementing the same enum support in broadcom's gen_pack_header.py,
> and did this same simplification there.
> ---
> src/intel/genxml/gen_pack_header.py | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/src/intel/genxml/gen_pack_header.py b/src/intel/genxml/gen_pack_header.py
> index 9021f008a823..405f600174d2 100644
> --- a/src/intel/genxml/gen_pack_header.py
> +++ b/src/intel/genxml/gen_pack_header.py
> @@ -493,7 +493,8 @@ class Parser(object):
>
> self.instruction = None
> self.structs = {}
> - self.enums = {}
> + # Set of enum names we've seen.
> + self.enums = set()
> self.registers = {}
>
> def gen_prefix(self, name):
> @@ -540,7 +541,7 @@ class Parser(object):
> elif name == "enum":
> self.values = []
> self.enum = safe_name(attrs["name"])
> - self.enums[attrs["name"]] = 1
> + self.enums.add(attrs["name"])
> if "prefix" in attrs:
> self.prefix = safe_name(attrs["prefix"])
> else:
>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170920/d532f111/attachment.sig>
More information about the mesa-dev
mailing list