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

Dylan Baker baker.dylan.c at gmail.com
Tue Dec 29 14:37:54 PST 2015


Okay, I can fix that too.

On Sun, Dec 27, 2015 at 7:43 AM, Frank Henigman <fjhenigman at google.com>
wrote:

> On Wed, Dec 16, 2015 at 8:37 PM,  <baker.dylan.c at gmail.com> wrote:
> > From: Dylan Baker <baker.dylan.c at gmail.com>
> >
> > 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 <dylanx.c.baker at intel.com>
> > ---
> >  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 at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/waffle
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/waffle/attachments/20151229/5cdde02e/attachment.html>


More information about the waffle mailing list