logging: make _nm_logging_clear_platform_logging_cache() a regular function
Previously, _nm_logging_clear_platform_logging_cache was an extern variable, and NMLinuxPlatform would set it to a function pointer at certain points. That's unnecessary complex, also when trying to make nm-logging thread-safe, it's just more global variables that need to be considered. Don't do it that way, but just link in a regular function.
This commit is contained in:
@@ -42,8 +42,6 @@
|
||||
#include "nm-utils/nm-time-utils.h"
|
||||
#include "nm-errors.h"
|
||||
|
||||
void (*_nm_logging_clear_platform_logging_cache) (void);
|
||||
|
||||
static void
|
||||
nm_log_handler (const char *log_domain,
|
||||
GLogLevelFlags level,
|
||||
@@ -403,7 +401,6 @@ nm_logging_setup (const char *level,
|
||||
_nm_logging_enabled_state[i] = new_logging[i];
|
||||
|
||||
if ( had_platform_debug
|
||||
&& _nm_logging_clear_platform_logging_cache
|
||||
&& !nm_logging_enabled (LOGL_DEBUG, LOGD_PLATFORM)) {
|
||||
/* when debug logging is enabled, platform will cache all access to
|
||||
* sysctl. When the user disables debug-logging, we want to clear that
|
||||
|
@@ -271,8 +271,6 @@ gboolean nm_logging_syslog_enabled (void);
|
||||
#define _LOG3t_err(errsv, ...) G_STMT_START { if (FALSE) { _NMLOG3_err (errsv, LOGL_TRACE, __VA_ARGS__); } } G_STMT_END
|
||||
#endif
|
||||
|
||||
extern void (*_nm_logging_clear_platform_logging_cache) (void);
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define __NMLOG_DEFAULT(level, domain, prefix, ...) \
|
||||
@@ -292,4 +290,8 @@ extern void (*_nm_logging_clear_platform_logging_cache) (void);
|
||||
_NM_UTILS_MACRO_REST(__VA_ARGS__)); \
|
||||
} G_STMT_END
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
extern void _nm_logging_clear_platform_logging_cache (void);
|
||||
|
||||
#endif /* __NETWORKMANAGER_LOGGING_H__ */
|
||||
|
@@ -4146,8 +4146,8 @@ sysctl_set (NMPlatform *platform, const char *pathid, int dirfd, const char *pat
|
||||
|
||||
static GSList *sysctl_clear_cache_list;
|
||||
|
||||
static void
|
||||
_nm_logging_clear_platform_logging_cache_impl (void)
|
||||
void
|
||||
_nm_logging_clear_platform_logging_cache (void)
|
||||
{
|
||||
while (sysctl_clear_cache_list) {
|
||||
NMLinuxPlatformPrivate *priv = NM_LINUX_PLATFORM_GET_PRIVATE (sysctl_clear_cache_list->data);
|
||||
@@ -4167,7 +4167,6 @@ _log_dbg_sysctl_get_impl (NMPlatform *platform, const char *pathid, const char *
|
||||
const char *prev_value = NULL;
|
||||
|
||||
if (!priv->sysctl_get_prev_values) {
|
||||
_nm_logging_clear_platform_logging_cache = _nm_logging_clear_platform_logging_cache_impl;
|
||||
sysctl_clear_cache_list = g_slist_prepend (sysctl_clear_cache_list, platform);
|
||||
priv->sysctl_get_prev_values = g_hash_table_new_full (nm_str_hash, g_str_equal, g_free, g_free);
|
||||
} else
|
||||
|
Reference in New Issue
Block a user