Re: [waffle] [RFC 2/3] wflinfo.c: split version, renderer, and vendor checks

2015-12-30 Thread Chad Versace
On 12/29/2015 02:37 PM, Dylan Baker wrote:
> Okay, I can fix that too.
> 
> On Sun, Dec 27, 2015 at 7:43 AM, Frank Henigman  > wrote:
> 
> On Wed, Dec 16, 2015 at 8:37 PM,   > wrote:
> > From: Dylan Baker  >
> >
> > Pull these out into helper functions, this change will be used in a
> > following patch to add a json printer.
> >
> > Signed-off-by: Dylan Baker  >
> > ---
> >  src/utils/wflinfo.c | 50 
> --
> >  1 file changed, 36 insertions(+), 14 deletions(-)

> > +const char * vendor =  get_vendor();
> > +const char * renderer = get_renderer();
> > +const char * version_str = get_version();
> 
> nit: usually no space after *

Yes. The convention in Waffle is ``const char *vendor``. Other than that,
the patch looks good.

___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [RFC 2/3] wflinfo.c: split version, renderer, and vendor checks

2015-12-29 Thread Dylan Baker
Okay, I can fix that too.

On Sun, Dec 27, 2015 at 7:43 AM, Frank Henigman 
wrote:

> On Wed, Dec 16, 2015 at 8:37 PM,   wrote:
> > From: Dylan Baker 
> >
> > Pull these out into helper functions, this change will be used in a
> > following patch to add a json printer.
> >
> > Signed-off-by: Dylan Baker 
> > ---
> >  src/utils/wflinfo.c | 50
> --
> >  1 file changed, 36 insertions(+), 14 deletions(-)
> >
> > diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c
> > index 905fd90..b843757 100644
> > --- a/src/utils/wflinfo.c
> > +++ b/src/utils/wflinfo.c
> > @@ -458,6 +458,39 @@ parse_version(const char *version)
> >  return (major * 10) + minor;
> >  }
> >
> > +static const char *
> > +get_vendor(void)
> > +{
> > +const char *vendor = (const char *) glGetString(GL_VENDOR);
> > +if (glGetError() != GL_NO_ERROR || vendor == NULL) {
> > +vendor = "WFLINFO_GL_ERROR";
> > +}
> > +
> > +return vendor;
> > +}
> > +
> > +static const char *
> > +get_renderer(void)
> > +{
> > +const char *renderer = (const char *) glGetString(GL_RENDERER);
> > +if (glGetError() != GL_NO_ERROR || renderer == NULL) {
> > +renderer = "WFLINFO_GL_ERROR";
> > +}
> > +
> > +return renderer;
> > +}
> > +
> > +static const char *
> > +get_version(void)
> > +{
> > +const char *version_str = (const char *) glGetString(GL_VERSION);
> > +if (glGetError() != GL_NO_ERROR || version_str == NULL) {
> > +version_str = "WFLINFO_GL_ERROR";
> > +}
> > +
> > +return version_str;
> > +}
> > +
> >  static void
> >  print_extensions(bool use_stringi)
> >  {
> > @@ -539,20 +572,9 @@ print_wflinfo(const struct options *opts)
> >  /* Clear all errors */
> >  }
> >
> > -const char *vendor = (const char *) glGetString(GL_VENDOR);
> > -if (glGetError() != GL_NO_ERROR || vendor == NULL) {
> > -vendor = "WFLINFO_GL_ERROR";
> > -}
> > -
> > -const char *renderer = (const char *) glGetString(GL_RENDERER);
> > -if (glGetError() != GL_NO_ERROR || renderer == NULL) {
> > -renderer = "WFLINFO_GL_ERROR";
> > -}
> > -
> > -const char *version_str = (const char *) glGetString(GL_VERSION);
> > -if (glGetError() != GL_NO_ERROR || version_str == NULL) {
> > -version_str = "WFLINFO_GL_ERROR";
> > -}
> > +const char * vendor =  get_vendor();
> > +const char * renderer = get_renderer();
> > +const char * version_str = get_version();
>
> nit: usually no space after *
>
> >  const char *platform = enum_map_to_str(platform_map,
> opts->platform);
> >  assert(platform != NULL);
> > --
> > 2.6.4
> >
> > ___
> > waffle mailing list
> > waffle@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/waffle
>
___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle


Re: [waffle] [RFC 2/3] wflinfo.c: split version, renderer, and vendor checks

2015-12-27 Thread Frank Henigman
On Wed, Dec 16, 2015 at 8:37 PM,   wrote:
> From: Dylan Baker 
>
> Pull these out into helper functions, this change will be used in a
> following patch to add a json printer.
>
> Signed-off-by: Dylan Baker 
> ---
>  src/utils/wflinfo.c | 50 --
>  1 file changed, 36 insertions(+), 14 deletions(-)
>
> diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c
> index 905fd90..b843757 100644
> --- a/src/utils/wflinfo.c
> +++ b/src/utils/wflinfo.c
> @@ -458,6 +458,39 @@ parse_version(const char *version)
>  return (major * 10) + minor;
>  }
>
> +static const char *
> +get_vendor(void)
> +{
> +const char *vendor = (const char *) glGetString(GL_VENDOR);
> +if (glGetError() != GL_NO_ERROR || vendor == NULL) {
> +vendor = "WFLINFO_GL_ERROR";
> +}
> +
> +return vendor;
> +}
> +
> +static const char *
> +get_renderer(void)
> +{
> +const char *renderer = (const char *) glGetString(GL_RENDERER);
> +if (glGetError() != GL_NO_ERROR || renderer == NULL) {
> +renderer = "WFLINFO_GL_ERROR";
> +}
> +
> +return renderer;
> +}
> +
> +static const char *
> +get_version(void)
> +{
> +const char *version_str = (const char *) glGetString(GL_VERSION);
> +if (glGetError() != GL_NO_ERROR || version_str == NULL) {
> +version_str = "WFLINFO_GL_ERROR";
> +}
> +
> +return version_str;
> +}
> +
>  static void
>  print_extensions(bool use_stringi)
>  {
> @@ -539,20 +572,9 @@ print_wflinfo(const struct options *opts)
>  /* Clear all errors */
>  }
>
> -const char *vendor = (const char *) glGetString(GL_VENDOR);
> -if (glGetError() != GL_NO_ERROR || vendor == NULL) {
> -vendor = "WFLINFO_GL_ERROR";
> -}
> -
> -const char *renderer = (const char *) glGetString(GL_RENDERER);
> -if (glGetError() != GL_NO_ERROR || renderer == NULL) {
> -renderer = "WFLINFO_GL_ERROR";
> -}
> -
> -const char *version_str = (const char *) glGetString(GL_VERSION);
> -if (glGetError() != GL_NO_ERROR || version_str == NULL) {
> -version_str = "WFLINFO_GL_ERROR";
> -}
> +const char * vendor =  get_vendor();
> +const char * renderer = get_renderer();
> +const char * version_str = get_version();

nit: usually no space after *

>  const char *platform = enum_map_to_str(platform_map, opts->platform);
>  assert(platform != NULL);
> --
> 2.6.4
>
> ___
> waffle mailing list
> waffle@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/waffle
___
waffle mailing list
waffle@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/waffle