gallium/hud: use #ifdef to test for macro existence
authorEric Engestrom <eric.engestrom@imgtec.com>
Wed, 29 Nov 2017 14:19:26 +0000 (14:19 +0000)
committerEric Engestrom <eric.engestrom@imgtec.com>
Fri, 1 Dec 2017 13:49:42 +0000 (13:49 +0000)
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/auxiliary/hud/hud_context.c
src/gallium/auxiliary/hud/hud_cpufreq.c
src/gallium/auxiliary/hud/hud_diskstat.c
src/gallium/auxiliary/hud/hud_nic.c
src/gallium/auxiliary/hud/hud_private.h
src/gallium/auxiliary/hud/hud_sensors_temp.c

index bd7c8cbb381f04c7384e56563a61b6149399cab8..64e5579b4e275a13512550d7e5f1745db6cda040 100644 (file)
@@ -1201,7 +1201,7 @@ hud_parse_env_var(struct hud_context *hud, struct pipe_screen *screen,
       }
 
       /* Add a graph. */
-#if HAVE_GALLIUM_EXTRA_HUD || HAVE_LIBSENSORS
+#if defined(HAVE_GALLIUM_EXTRA_HUD) || defined(HAVE_LIBSENSORS)
       char arg_name[64];
 #endif
       /* IF YOU CHANGE THIS, UPDATE print_help! */
@@ -1229,7 +1229,7 @@ hud_parse_env_var(struct hud_context *hud, struct pipe_screen *screen,
       else if (strcmp(name, "main-thread-busy") == 0) {
          hud_thread_busy_install(pane, name, true);
       }
-#if HAVE_GALLIUM_EXTRA_HUD
+#ifdef HAVE_GALLIUM_EXTRA_HUD
       else if (sscanf(name, "nic-rx-%s", arg_name) == 1) {
          hud_nic_graph_install(pane, arg_name, NIC_DIRECTION_RX);
       }
@@ -1261,7 +1261,7 @@ hud_parse_env_var(struct hud_context *hud, struct pipe_screen *screen,
          pane->type = PIPE_DRIVER_QUERY_TYPE_HZ;
       }
 #endif
-#if HAVE_LIBSENSORS
+#ifdef HAVE_LIBSENSORS
       else if (sscanf(name, "sensors_temp_cu-%s", arg_name) == 1) {
          hud_sensors_temp_graph_install(pane, arg_name,
                                         SENSORS_TEMP_CURRENT);
@@ -1536,12 +1536,12 @@ print_help(struct pipe_screen *screen)
       puts("    cs-invocations");
    }
 
-#if HAVE_GALLIUM_EXTRA_HUD
+#ifdef HAVE_GALLIUM_EXTRA_HUD
    hud_get_num_disks(1);
    hud_get_num_nics(1);
    hud_get_num_cpufreq(1);
 #endif
-#if HAVE_LIBSENSORS
+#ifdef HAVE_LIBSENSORS
    hud_get_num_sensors(1);
 #endif
 
index 2b881a850e3ceb80d2a49bc9d7355b8903cd9a84..f5b7c0f2eb490bf8c89ef0600401dfba3c1e4a5e 100644 (file)
@@ -26,7 +26,7 @@
  *
  **************************************************************************/
 
-#if HAVE_GALLIUM_EXTRA_HUD
+#ifdef HAVE_GALLIUM_EXTRA_HUD
 
 /* Purpose:
  * Reading /sys/devices/system/cpu/cpu?/cpufreq/scaling_???_freq
index 53b32baef226d663f64b8ad779b481d24a7438fc..44174d655db9c767658d37257bacd61e597b312d 100644 (file)
@@ -26,7 +26,7 @@
  *
  **************************************************************************/
 
-#if HAVE_GALLIUM_EXTRA_HUD
+#ifdef HAVE_GALLIUM_EXTRA_HUD
 
 /* Purpose: Reading /sys/block/<*>/stat MB/s read/write throughput per second,
  * displaying on the HUD.
index bb29a90dbcab9eea14ec960562b7592213e5da6f..1de5705edf29e66ededb50ecc9190a2bd798ca22 100644 (file)
@@ -26,7 +26,7 @@
  *
  **************************************************************************/
 
-#if HAVE_GALLIUM_EXTRA_HUD
+#ifdef HAVE_GALLIUM_EXTRA_HUD
 
 /* Purpose: Reading network interface RX/TX throughput per second,
  * displaying on the HUD.
index 7f0294badd3f553b995c5c203d3da7d7b1c206fc..9e8d74c2f885f4a1cd84b58ee5f38287d17564dd 100644 (file)
@@ -178,7 +178,7 @@ void hud_batch_query_update(struct hud_batch_query_context *bq,
 void hud_batch_query_cleanup(struct hud_batch_query_context **pbq,
                              struct pipe_context *pipe);
 
-#if HAVE_GALLIUM_EXTRA_HUD
+#ifdef HAVE_GALLIUM_EXTRA_HUD
 int hud_get_num_nics(bool displayhelp);
 #define NIC_DIRECTION_RX 1
 #define NIC_DIRECTION_TX 2
@@ -199,7 +199,7 @@ int hud_get_num_cpufreq(bool displayhelp);
 void hud_cpufreq_graph_install(struct hud_pane *pane, int cpu_index, unsigned int mode);
 #endif
 
-#if HAVE_LIBSENSORS
+#ifdef HAVE_LIBSENSORS
 int hud_get_num_sensors(bool displayhelp);
 #define SENSORS_TEMP_CURRENT     1
 #define SENSORS_TEMP_CRITICAL    2
index 7ae6f71b55c81216140cbeae79bef1d9a0f035bc..b912a4ea7a8d2e59aff45fffc008c48545c7f62c 100644 (file)
@@ -26,7 +26,7 @@
  *
  **************************************************************************/
 
-#if HAVE_LIBSENSORS
+#ifdef HAVE_LIBSENSORS
 /* Purpose: Extract lm-sensors data, expose temperature, power, voltage. */
 
 #include "hud/hud_private.h"