Cleanup: polish verbose mode checking
authorChengwei Yang <chengwei.yang@intel.com>
Fri, 23 Aug 2013 08:49:39 +0000 (16:49 +0800)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Fri, 23 Aug 2013 10:51:18 +0000 (11:51 +0100)
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
bus/selinux.c
bus/signals.c
dbus/dbus-connection.c
dbus/dbus-pending-call.c

index 36287e9..57c9432 100644 (file)
@@ -936,8 +936,7 @@ bus_selinux_get_policy_root (void)
 void
 bus_selinux_id_table_print (DBusHashTable *service_table)
 {
-#ifdef DBUS_ENABLE_VERBOSE_MODE
-#ifdef HAVE_SELINUX
+#if defined (DBUS_ENABLE_VERBOSE_MODE) && defined (HAVE_SELINUX)
   DBusHashIter iter;
 
   if (!selinux_enabled)
@@ -953,19 +952,17 @@ bus_selinux_id_table_print (DBusHashTable *service_table)
       _dbus_verbose ("The context is %s\n", sid->ctx);
       _dbus_verbose ("The refcount is %d\n", sid->refcnt);
     }
-#endif /* HAVE_SELINUX */
-#endif /* DBUS_ENABLE_VERBOSE_MODE */
+#endif /* DBUS_ENABLE_VERBOSE_MODE && HAVE_SELINUX */
 }
 
 
-#ifdef DBUS_ENABLE_VERBOSE_MODE
-#ifdef HAVE_SELINUX
 /**
  * Print out some AVC statistics.
  */
 static void
 bus_avc_print_stats (void)
 {
+#if defined (DBUS_ENABLE_VERBOSE_MODE) && defined (HAVE_SELINUX)
   struct avc_cache_stats cstats;
 
   if (!selinux_enabled)
@@ -983,9 +980,8 @@ bus_avc_print_stats (void)
   _dbus_verbose ("CAV hits: %d\n", cstats.cav_hits);
   _dbus_verbose ("CAV probes: %d\n", cstats.cav_probes);
   _dbus_verbose ("CAV misses: %d\n", cstats.cav_misses);
+#endif /* DBUS_ENABLE_VERBOSE_MODE && HAVE_SELINUX */
 }
-#endif /* HAVE_SELINUX */
-#endif /* DBUS_ENABLE_VERBOSE_MODE */
 
 
 /**
@@ -1005,12 +1001,7 @@ bus_selinux_shutdown (void)
       sidput (bus_sid);
       bus_sid = SECSID_WILD;
 
-#ifdef DBUS_ENABLE_VERBOSE_MODE
-      if (_dbus_is_verbose()) 
-        bus_avc_print_stats ();
-#endif /* DBUS_ENABLE_VERBOSE_MODE */
+      bus_avc_print_stats ();
 
       avc_destroy ();
 #ifdef HAVE_LIBAUDIT
index 72487ed..dab7154 100644 (file)
@@ -1980,12 +1980,10 @@ get_recipients_from_list (DBusList       **rules,
               if (!_dbus_list_append (recipients_p, rule->matches_go_to))
                 return FALSE;
             }
-#ifdef DBUS_ENABLE_VERBOSE_MODE
           else
             {
               _dbus_verbose ("Connection already receiving this message, so not adding again\n");
             }
-#endif /* DBUS_ENABLE_VERBOSE_MODE */
         }
 
       link = _dbus_list_get_next_link (rules, link);
index a6caaea..759a649 100644 (file)
  * @{
  */
 
-#ifdef DBUS_ENABLE_VERBOSE_MODE
 static void
 _dbus_connection_trace_ref (DBusConnection *connection,
     int old_refcount,
     int new_refcount,
     const char *why)
 {
+#ifdef DBUS_ENABLE_VERBOSE_MODE
   static int enabled = -1;
 
   _dbus_trace_ref ("DBusConnection", connection, old_refcount, new_refcount,
       why, "DBUS_CONNECTION_TRACE", &enabled);
-}
-#else
-#define _dbus_connection_trace_ref(c,o,n,w) \
-  do \
-  {\
-    (void) (o); \
-    (void) (n); \
-  } while (0)
 #endif
+}
 
 /**
  * Internal struct representing a message filter function 
index 1604408..be53410 100644 (file)
@@ -79,26 +79,19 @@ struct DBusPendingCall
   unsigned int timeout_added : 1;                 /**< Have added the timeout */
 };
 
-#ifdef DBUS_ENABLE_VERBOSE_MODE
 static void
 _dbus_pending_call_trace_ref (DBusPendingCall *pending_call,
     int old_refcount,
     int new_refcount,
     const char *why)
 {
+#ifdef DBUS_ENABLE_VERBOSE_MODE
   static int enabled = -1;
 
   _dbus_trace_ref ("DBusPendingCall", pending_call, old_refcount,
       new_refcount, why, "DBUS_PENDING_CALL_TRACE", &enabled);
-}
-#else
-#define _dbus_pending_call_trace_ref(p, o, n, w) \
-  do \
-  {\
-    (void) (o); \
-    (void) (n); \
-  } while (0)
 #endif
+}
 
 static dbus_int32_t notify_user_data_slot = -1;