[PATCH 5/8] lib: Allow users of env_set() to specify a default value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So when the environment value isn't set, one can specify the default
value to return.

Signed-off-by: Damien Lespiau <damien.lespiau@xxxxxxxxx>
---
 lib/drmtest.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 016619c..26748b3 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -689,13 +689,13 @@ bool drmtest_only_list_subtests(void)
 	return list_subtests;
 }
 
-static bool env_set(const char *env_var)
+static bool env_set(const char *env_var, bool default_value)
 {
 	char *val;
 
 	val = getenv(env_var);
 	if (!val)
-		return false;
+		return default_value;
 
 	return atoi(val) != 0;
 }
@@ -705,7 +705,7 @@ bool drmtest_run_in_simulation(void)
 	static int simulation = -1;
 
 	if (simulation == -1)
-		simulation = env_set("INTEL_SIMULATION");
+		simulation = env_set("INTEL_SIMULATION", false);
 
 	return simulation;
 }
-- 
1.8.3.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux