Re: [waffle] [RFC 1/3] wflinfo.c: split out flags struct
On Wed, Dec 16, 2015 at 8:37 PM,wrote: > From: Dylan Baker > > This is groundwork for adding a json interface to wflinfo. > --- > src/utils/wflinfo.c | 19 +++ > 1 file changed, 11 insertions(+), 8 deletions(-) > > diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c > index 268d4b8..905fd90 100644 > --- a/src/utils/wflinfo.c > +++ b/src/utils/wflinfo.c > @@ -487,17 +487,18 @@ print_extensions(bool use_stringi) > printf("\n"); > } > > +static struct { > +GLint flag; > +char *str; > +} flags[] = { > +{ GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT, "FORWARD_COMPATIBLE" }, > +{ GL_CONTEXT_FLAG_DEBUG_BIT, "DEBUG" }, > +{ GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB, "ROBUST_ACCESS" }, > +}; > + > static void > print_context_flags(void) > { > -static struct { > -GLint flag; > -char *str; > -} flags[] = { > -{ GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT, "FORWARD_COMPATIBLE" }, > -{ GL_CONTEXT_FLAG_DEBUG_BIT, "DEBUG" }, > -{ GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB, "ROBUST_ACCESS" }, > -}; > int flag_count = sizeof(flags) / sizeof(flags[0]); > GLint context_flags = 0; > > @@ -526,6 +527,8 @@ print_context_flags(void) > } > } > printf("\n"); > + > +return; Not a big deal but I don't see the point of adding this return. > } > > /// @brief Print out information about the context that was created. > -- > 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
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