summaryrefslogtreecommitdiff
path: root/src/nm-logging.h
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2016-05-19 19:05:43 +0200
committerThomas Haller <thaller@redhat.com>2016-05-20 12:50:52 +0200
commit4ed1784ce4d89b905ecfd75460f8c73893401442 (patch)
treea40b9fe9f20a4d344decb01c94023e75c71f839d /src/nm-logging.h
parenta9ef2f9c5092a7cd6dbb52aa2b0c18c3cca7627d (diff)
downloadNetworkManager-4ed1784ce4d89b905ecfd75460f8c73893401442.tar.gz
logging: make nm_logging_enabled() inline function
Basically every logging statement is wrapped by a nm_logging_enabled() to evaluate the function call of the logging lazy. Make the function a candidate for inlining, it safes some space. On a default build it goes for me from 2580584 to 2560104 bytes (20k). $ ./autogen.sh && make && strip ./src/NetworkManager
Diffstat (limited to 'src/nm-logging.h')
-rw-r--r--src/nm-logging.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/nm-logging.h b/src/nm-logging.h
index 27f89f5d5b..c134670501 100644
--- a/src/nm-logging.h
+++ b/src/nm-logging.h
@@ -158,7 +158,14 @@ void _nm_log_impl (const char *file,
const char *nm_logging_level_to_string (void);
const char *nm_logging_domains_to_string (void);
-gboolean nm_logging_enabled (NMLogLevel level, NMLogDomain domain);
+
+extern NMLogDomain _nm_logging_enabled_state[_LOGL_N_REAL];
+static inline gboolean
+nm_logging_enabled (NMLogLevel level, NMLogDomain domain)
+{
+ nm_assert (((guint) level) < G_N_ELEMENTS (_nm_logging_enabled_state));
+ return !!(_nm_logging_enabled_state[level] & domain);
+}
const char *nm_logging_all_levels_to_string (void);
const char *nm_logging_all_domains_to_string (void);