Mesa (master): u_format_s3tc.c: Don't call getenv() twice

Matt Turner mattst88 at kemper.freedesktop.org
Fri Oct 12 19:24:30 UTC 2012


Module: Mesa
Branch: master
Commit: fb85b204d3dd2016ca828bba602262f182f8b4b4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fb85b204d3dd2016ca828bba602262f182f8b4b4

Author: Matt Turner <mattst88 at gmail.com>
Date:   Wed Oct 10 15:34:59 2012 -0700

u_format_s3tc.c: Don't call getenv() twice

Reviewed-by: Brian Paul <brianp at vmware.com>

---

 src/gallium/auxiliary/util/u_format_s3tc.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_format_s3tc.c b/src/gallium/auxiliary/util/u_format_s3tc.c
index d8a7c0d..4a9dc22 100644
--- a/src/gallium/auxiliary/util/u_format_s3tc.c
+++ b/src/gallium/auxiliary/util/u_format_s3tc.c
@@ -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;




More information about the mesa-commit mailing list