u_format_s3tc.c: Don't call getenv() twice
authorMatt Turner <mattst88@gmail.com>
Wed, 10 Oct 2012 22:34:59 +0000 (15:34 -0700)
committerMatt Turner <mattst88@gmail.com>
Fri, 12 Oct 2012 19:26:03 +0000 (12:26 -0700)
Reviewed-by: Brian Paul <brianp@vmware.com>
src/gallium/auxiliary/util/u_format_s3tc.c

index d8a7c0d453fdc37790873bf534bcd926ea2fdeb2..4a9dc2237e42dd69e8140296db9a4f513c3a67fb 100644 (file)
@@ -109,6 +109,7 @@ util_format_s3tc_init(void)
    util_dl_proc fetch_2d_texel_rgba_dxt3;
    util_dl_proc fetch_2d_texel_rgba_dxt5;
    util_dl_proc tx_compress_dxtn;
+   char *force_s3tc_enable;
 
    if (!first_time)
       return;
@@ -119,8 +120,8 @@ util_format_s3tc_init(void)
 
    library = util_dl_open(DXTN_LIBNAME);
    if (!library) {
-      if (getenv("force_s3tc_enable") &&
-          !strcmp(getenv("force_s3tc_enable"), "true")) {
+      if ((force_s3tc_enable = getenv("force_s3tc_enable")) &&
+          !strcmp(force_s3tc_enable, "true")) {
          debug_printf("couldn't open " DXTN_LIBNAME ", enabling DXTn due to "
             "force_s3tc_enable=true environment variable\n");
          util_format_s3tc_enabled = TRUE;