This patch is

Reviewed-by: Ian Romanick <[email protected]>

On 03/31/2016 05:04 PM, Dylan Baker wrote:
> Use a boolean instead of 0 or 1, and use an assert rather than a runtime
> error.
> 
> Signed-off-by: Dylan Baker <[email protected]>
> ---
>  src/mapi/glapi/gen/gl_XML.py | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/src/mapi/glapi/gen/gl_XML.py b/src/mapi/glapi/gen/gl_XML.py
> index 334fd6e..34f987e 100644
> --- a/src/mapi/glapi/gen/gl_XML.py
> +++ b/src/mapi/glapi/gen/gl_XML.py
> @@ -66,15 +66,13 @@ def is_attr_true(element, name, default="false"):
>      The value read from the attribute list must be either 'true' or
>      'false'.  If the value is 'false', zero will be returned.  If the
>      value is 'true', non-zero will be returned.  An exception will be
> -    raised for any other value."""
> +    raised for any other value.
>  
> +    """
>      value = element.get(name, default)
> -    if value == "true":
> -        return 1
> -    elif value == "false":
> -        return 0
> -    else:
> -        raise RuntimeError('Invalid value "%s" for boolean "%s".' % (value, 
> name))
> +    assert value in ('true', 'false'), 'value {} was not a 
> bool'.format(value)
> +
> +    return value == 'true'
>  
>  
>  class gl_print_base(object):
> 

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to