aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChad Versace <chad.versace@linux.intel.com>2014-03-30 16:50:38 -0700
committerChad Versace <chad.versace@linux.intel.com>2014-05-08 21:15:12 -0700
commitc3f67957e0e3513837fcac6548c4e610c5e14746 (patch)
tree2e97eee87bde81df91c03fb0aaa1b64191eb3fdd /src
parent1ae308a8d5aa1725e9f25b59b5b57462b11acdd9 (diff)
downloadwaffle-c3f67957e0e3513837fcac6548c4e610c5e14746.tar.gz
wflinfo: Don't modify struct options after initialization
parse_args() initializes global options. After that, options should be immutable. To ensure that, constify each occurence of struct options as a function parameter. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/utils/wflinfo.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/utils/wflinfo.c b/src/utils/wflinfo.c
index 386bdd0..58d6446 100644
--- a/src/utils/wflinfo.c
+++ b/src/utils/wflinfo.c
@@ -497,7 +497,7 @@ print_context_flags(void)
/// @brief Print out information about the context that was created.
static bool
-print_wflinfo(struct options *opts)
+print_wflinfo(const struct options *opts)
{
while(glGetError() != GL_NO_ERROR) {
/* Clear all errors */
@@ -601,7 +601,7 @@ removeXcodeArgs(int *argc, char **argv)
#endif // __APPLE__
static struct waffle_context *
-wflinfo_try_create_context(struct options *opts,
+wflinfo_try_create_context(const struct options *opts,
struct waffle_config **config,
struct waffle_display *dpy,
bool exit_on_fail)
@@ -688,7 +688,7 @@ fail:
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
static struct waffle_context *
-wflinfo_create_context(struct options *opts,
+wflinfo_create_context(const struct options *opts,
struct waffle_config **config,
struct waffle_display *dpy)
{
@@ -705,10 +705,11 @@ wflinfo_create_context(struct options *opts,
static int known_gl_profile_versions[] =
{ 32, 33, 40, 41, 42, 43, 44 };
+ struct options tmp_opts = *opts;
+
for (int i = ARRAY_SIZE(known_gl_profile_versions) - 1; i >= 0; i--) {
- opts->context_version = known_gl_profile_versions[i];
- ctx = wflinfo_try_create_context(opts, config, dpy, false);
- opts->context_version = -1;
+ tmp_opts.context_version = known_gl_profile_versions[i];
+ ctx = wflinfo_try_create_context(&tmp_opts, config, dpy, false);
if (ctx)
break;
}