all: merge branch 'th/device-pending-action-bgo777831' (part 1, cached-quark)

Add and use NM_CACHED_QUARK() macro.

https://bugzilla.gnome.org/show_bug.cgi?id=777831
This commit is contained in:
Thomas Haller 2017-02-10 14:34:54 +01:00
commit 61554cae7a
20 changed files with 112 additions and 111 deletions

View file

@ -63,6 +63,8 @@ typedef struct {
GMainLoop *loop = NULL;
struct termios termios_orig;
NM_CACHED_QUARK_FCN ("nmcli-error-quark", nmcli_error_quark)
static void
complete_field (GHashTable *h, const char *setting, NmcOutputField field[])
{
@ -163,18 +165,6 @@ complete_fields (const char *prefix)
}
/* Get an error quark for use with GError */
GQuark
nmcli_error_quark (void)
{
static GQuark error_quark = 0;
if (G_UNLIKELY (error_quark == 0))
error_quark = g_quark_from_static_string ("nmcli-error-quark");
return error_quark;
}
static void
usage (void)
{

View file

@ -2461,13 +2461,12 @@ nm_connection_private_free (NMConnectionPrivate *priv)
static NMConnectionPrivate *
nm_connection_get_private (NMConnection *connection)
{
static GQuark key = 0;
GQuark key;
NMConnectionPrivate *priv;
nm_assert (NM_IS_CONNECTION (connection));
if (G_UNLIKELY (key == 0))
key = g_quark_from_static_string ("NMConnectionPrivate");
key = NM_CACHED_QUARK ("NMConnectionPrivate");
priv = g_object_get_qdata ((GObject *) connection, key);
if (!priv) {

View file

@ -26,14 +26,14 @@
#include "nm-vpn-dbus-interface.h"
#include "nm-core-internal.h"
G_DEFINE_QUARK (nm-agent-manager-error-quark, nm_agent_manager_error)
G_DEFINE_QUARK (nm-connection-error-quark, nm_connection_error)
G_DEFINE_QUARK (nm-crypto-error-quark, nm_crypto_error)
G_DEFINE_QUARK (nm-device-error-quark, nm_device_error)
G_DEFINE_QUARK (nm-manager-error-quark, nm_manager_error)
G_DEFINE_QUARK (nm-secret-agent-error-quark, nm_secret_agent_error)
G_DEFINE_QUARK (nm-settings-error-quark, nm_settings_error)
G_DEFINE_QUARK (nm-vpn-plugin-error-quark, nm_vpn_plugin_error)
NM_CACHED_QUARK_FCN ("nm-agent-manager-error-quark", nm_agent_manager_error_quark)
NM_CACHED_QUARK_FCN ("nm-connection-error-quark", nm_connection_error_quark)
NM_CACHED_QUARK_FCN ("nm-crypto-error-quark", nm_crypto_error_quark)
NM_CACHED_QUARK_FCN ("nm-device-error-quark", nm_device_error_quark)
NM_CACHED_QUARK_FCN ("nm-manager-error-quark", nm_manager_error_quark)
NM_CACHED_QUARK_FCN ("nm-secret-agent-error-quark", nm_secret_agent_error_quark)
NM_CACHED_QUARK_FCN ("nm-settings-error-quark", nm_settings_error_quark)
NM_CACHED_QUARK_FCN ("nm-vpn-plugin-error-quark", nm_vpn_plugin_error_quark)
static void
register_error_domain (GQuark domain,

View file

@ -304,8 +304,8 @@ typedef struct {
NMSettingPropertyTransformFromFunc from_dbus;
} NMSettingProperty;
static GQuark setting_property_overrides_quark;
static GQuark setting_properties_quark;
static NM_CACHED_QUARK_FCN ("nm-setting-property-overrides", setting_property_overrides_quark)
static NM_CACHED_QUARK_FCN ("nm-setting-properties", setting_properties_quark)
static NMSettingProperty *
find_property (GArray *properties, const char *name)
@ -341,7 +341,7 @@ add_property_override (NMSettingClass *setting_class,
GArray *overrides;
NMSettingProperty override;
g_return_if_fail (g_type_get_qdata (setting_type, setting_properties_quark) == NULL);
g_return_if_fail (g_type_get_qdata (setting_type, setting_properties_quark ()) == NULL);
memset (&override, 0, sizeof (override));
override.name = property_name;
@ -354,10 +354,10 @@ add_property_override (NMSettingClass *setting_class,
override.to_dbus = to_dbus;
override.from_dbus = from_dbus;
overrides = g_type_get_qdata (setting_type, setting_property_overrides_quark);
overrides = g_type_get_qdata (setting_type, setting_property_overrides_quark ());
if (!overrides) {
overrides = g_array_new (FALSE, FALSE, sizeof (NMSettingProperty));
g_type_set_qdata (setting_type, setting_property_overrides_quark, overrides);
g_type_set_qdata (setting_type, setting_property_overrides_quark (), overrides);
}
g_return_if_fail (find_property (overrides, property_name) == NULL);
@ -530,14 +530,14 @@ nm_setting_class_ensure_properties (NMSettingClass *setting_class)
GParamSpec **property_specs;
guint n_property_specs, i;
properties = g_type_get_qdata (type, setting_properties_quark);
properties = g_type_get_qdata (type, setting_properties_quark ());
if (properties)
return properties;
/* Build overrides array from @setting_class and its superclasses */
overrides = g_array_new (FALSE, FALSE, sizeof (NMSettingProperty));
for (otype = type; otype != G_TYPE_OBJECT; otype = g_type_parent (otype)) {
type_overrides = g_type_get_qdata (otype, setting_property_overrides_quark);
type_overrides = g_type_get_qdata (otype, setting_property_overrides_quark ());
if (type_overrides)
g_array_append_vals (overrides, (NMSettingProperty *)type_overrides->data, type_overrides->len);
}
@ -568,7 +568,7 @@ nm_setting_class_ensure_properties (NMSettingClass *setting_class)
}
g_array_unref (overrides);
g_type_set_qdata (type, setting_properties_quark, properties);
g_type_set_qdata (type, setting_properties_quark (), properties);
return properties;
}
@ -1995,11 +1995,6 @@ nm_setting_class_init (NMSettingClass *setting_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (setting_class);
if (!setting_property_overrides_quark)
setting_property_overrides_quark = g_quark_from_static_string ("nm-setting-property-overrides");
if (!setting_properties_quark)
setting_properties_quark = g_quark_from_static_string ("nm-setting-properties");
g_type_class_add_private (setting_class, sizeof (NMSettingPrivate));
/* virtual methods */

View file

@ -153,15 +153,7 @@ static const GPtrArray empty = { 0, };
*
* Returns: the error quark used for #NMClient errors.
**/
GQuark
nm_client_error_quark (void)
{
static GQuark quark;
if (G_UNLIKELY (!quark))
quark = g_quark_from_static_string ("nm-client-error-quark");
return quark;
}
NM_CACHED_QUARK_FCN ("nm-client-error-quark", nm_client_error_quark)
/*****************************************************************************/

View file

@ -37,7 +37,7 @@
static gboolean debug = FALSE;
#define dbgmsg(f,...) if (G_UNLIKELY (debug)) { g_message (f, ## __VA_ARGS__ ); }
G_DEFINE_QUARK (nm-obj-nm, _nm_object_obj_nm);
NM_CACHED_QUARK_FCN ("nm-obj-nm", _nm_object_obj_nm_quark)
static void nm_object_initable_iface_init (GInitableIface *iface);
static void nm_object_async_initable_iface_init (GAsyncInitableIface *iface);

View file

@ -341,6 +341,40 @@ _NM_IN_STRSET_streq (const char *x, const char *s)
/*****************************************************************************/
/* NM_CACHED_QUARK() returns the GQuark for @string, but caches
* it in a static variable to speed up future lookups.
*
* @string must be a string literal.
*/
#define NM_CACHED_QUARK(string) \
({ \
static GQuark _nm_cached_quark = 0; \
\
(G_LIKELY (_nm_cached_quark != 0) \
? _nm_cached_quark \
: (_nm_cached_quark = g_quark_from_static_string (""string""))); \
})
/* NM_CACHED_QUARK_FCN() is essentially the same as G_DEFINE_QUARK
* with two differences:
* - @string must be a quited string-literal
* - @fcn must be the full function name, while G_DEFINE_QUARK() appends
* "_quark" to the function name.
* Both properties of G_DEFINE_QUARK() are non favorable, because you can no
* longer grep for string/fcn -- unless you are aware that you are searching
* for G_DEFINE_QUARK() and omit quotes / append _quark(). With NM_CACHED_QUARK_FCN(),
* ctags/cscope can locate the use of @fcn (though it doesn't recognize that
* NM_CACHED_QUARK_FCN() defines it).
*/
#define NM_CACHED_QUARK_FCN(string, fcn) \
GQuark \
fcn (void) \
{ \
return NM_CACHED_QUARK (string); \
}
/*****************************************************************************/
#define nm_streq(s1, s2) (strcmp (s1, s2) == 0)
#define nm_streq0(s1, s2) (g_strcmp0 (s1, s2) == 0)

View file

@ -240,7 +240,7 @@ _nm_utils_ascii_str_to_bool (const char *str,
/*****************************************************************************/
G_DEFINE_QUARK (nm-utils-error-quark, nm_utils_error)
NM_CACHED_QUARK_FCN ("nm-utils-error-quark", nm_utils_error_quark)
void
nm_utils_error_set_cancelled (GError **error,

View file

@ -22,13 +22,5 @@
#include "nm-bt-error.h"
GQuark
nm_bt_error_quark (void)
{
static GQuark quark = 0;
if (!quark)
quark = g_quark_from_static_string ("nm-bt-error");
return quark;
}
NM_CACHED_QUARK_FCN ("nm-bt-error", nm_bt_error_quark)

View file

@ -59,7 +59,7 @@ _LOG_DECLARE_SELF(NMDeviceEthernet);
/*****************************************************************************/
#define WIRED_SECRETS_TRIES "wired-secrets-tries"
static NM_CACHED_QUARK_FCN ("wired-secrets-tries", wired_secret_tries_quark)
#define PPPOE_RECONNECT_DELAY 7
#define PPPOE_ENCAP_OVERHEAD 8 /* 2 bytes for PPP, 6 for PPPoE */
@ -268,7 +268,7 @@ clear_secrets_tries (NMDevice *device)
if (req) {
connection = nm_act_request_get_applied_connection (req);
/* Clear wired secrets tries on success, failure, or when deactivating */
g_object_set_data (G_OBJECT (connection), WIRED_SECRETS_TRIES, NULL);
g_object_set_qdata (G_OBJECT (connection), wired_secret_tries_quark (), NULL);
}
}
@ -706,7 +706,7 @@ handle_auth_or_fail (NMDeviceEthernet *self,
applied_connection = nm_act_request_get_applied_connection (req);
tries = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (applied_connection), WIRED_SECRETS_TRIES));
tries = GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (applied_connection), wired_secret_tries_quark ()));
if (tries > 3)
return NM_ACT_STAGE_RETURN_FAILURE;
@ -719,7 +719,7 @@ handle_auth_or_fail (NMDeviceEthernet *self,
wired_secrets_get_secrets (self, setting_name,
NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION
| (new_secrets ? NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW : 0));
g_object_set_data (G_OBJECT (applied_connection), WIRED_SECRETS_TRIES, GUINT_TO_POINTER (++tries));
g_object_set_qdata (G_OBJECT (applied_connection), wired_secret_tries_quark (), GUINT_TO_POINTER (++tries));
} else
_LOGI (LOGD_DEVICE, "Cleared secrets, but setting didn't need any secrets.");

View file

@ -32,7 +32,8 @@
#include "nm-utils.h"
#define PLUGIN_PREFIX "libnm-device-plugin-"
#define PLUGIN_PATH_TAG "NMManager-plugin-path"
static NM_CACHED_QUARK_FCN ("NMManager-plugin-path", plugin_path_quark)
/*****************************************************************************/
@ -350,13 +351,13 @@ _add_factory (NMDeviceFactory *factory,
if (found) {
nm_log_warn (LOGD_PLATFORM, "Loading device plugin failed: multiple plugins "
"for same type (using '%s' instead of '%s')",
(char *) g_object_get_data (G_OBJECT (found), PLUGIN_PATH_TAG),
(char *) g_object_get_qdata (G_OBJECT (found), plugin_path_quark ()),
path);
return FALSE;
}
}
g_object_set_data_full (G_OBJECT (factory), PLUGIN_PATH_TAG, g_strdup (path), g_free);
g_object_set_qdata_full (G_OBJECT (factory), plugin_path_quark (), g_strdup (path), g_free);
for (i = 0; link_types && link_types[i] > NM_LINK_TYPE_UNKNOWN; i++)
g_hash_table_insert (factories_by_link, GUINT_TO_POINTER (link_types[i]), g_object_ref (factory));
for (i = 0; setting_types && setting_types[i]; i++)

View file

@ -90,7 +90,7 @@ G_DEFINE_TYPE (NMDeviceMacsec, nm_device_macsec, NM_TYPE_DEVICE)
/******************************************************************/
#define MACSEC_SECRETS_TRIES "macsec-secrets-tries"
static NM_CACHED_QUARK_FCN ("macsec-secrets-tries", macsec_secrets_tries_quark)
static void macsec_secrets_cancel (NMDeviceMacsec *self);
@ -505,7 +505,7 @@ handle_auth_or_fail (NMDeviceMacsec *self,
applied_connection = nm_act_request_get_applied_connection (req);
tries = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (applied_connection), MACSEC_SECRETS_TRIES));
tries = GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (applied_connection), macsec_secrets_tries_quark ()));
if (tries > 3)
return NM_ACT_STAGE_RETURN_FAILURE;
@ -518,7 +518,7 @@ handle_auth_or_fail (NMDeviceMacsec *self,
macsec_secrets_get_secrets (self, setting_name,
NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION
| (new_secrets ? NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW : 0));
g_object_set_data (G_OBJECT (applied_connection), MACSEC_SECRETS_TRIES, GUINT_TO_POINTER (++tries));
g_object_set_qdata (G_OBJECT (applied_connection), macsec_secrets_tries_quark (), GUINT_TO_POINTER (++tries));
} else
_LOGI (LOGD_DEVICE, "Cleared secrets, but setting didn't need any secrets.");
@ -768,7 +768,7 @@ clear_secrets_tries (NMDevice *device)
if (req) {
connection = nm_act_request_get_applied_connection (req);
/* Clear macsec secrets tries on success, failure, or when deactivating */
g_object_set_data (G_OBJECT (connection), MACSEC_SECRETS_TRIES, NULL);
g_object_set_qdata (G_OBJECT (connection), macsec_secrets_tries_quark (), NULL);
}
}

View file

@ -5517,7 +5517,7 @@ shared4_new_config (NMDevice *self, NMConnection *connection, NMDeviceStateReaso
nm_ip4_config_add_address (config, &address);
/* Remove the address lock when the object gets disposed */
g_object_set_data_full (G_OBJECT (config), "shared-ip",
g_object_set_qdata_full (G_OBJECT (config), NM_CACHED_QUARK ("shared-ip"),
GUINT_TO_POINTER (address.address),
release_shared_ip);

View file

@ -63,7 +63,7 @@ _LOG_DECLARE_SELF(NMDeviceWifi);
#define SCAN_RAND_MAC_ADDRESS_EXPIRE_MIN 5
#define WIRELESS_SECRETS_TRIES "wireless-secrets-tries"
static NM_CACHED_QUARK_FCN ("wireless-secrets-tries", wireless_secrets_tries_quark)
/*****************************************************************************/
@ -2255,7 +2255,7 @@ handle_auth_or_fail (NMDeviceWifi *self,
applied_connection = nm_act_request_get_applied_connection (req);
tries = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (applied_connection), WIRELESS_SECRETS_TRIES));
tries = GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (applied_connection), wireless_secrets_tries_quark ()));
if (tries > 3)
return NM_ACT_STAGE_RETURN_FAILURE;
@ -2267,7 +2267,7 @@ handle_auth_or_fail (NMDeviceWifi *self,
wifi_secrets_get_secrets (self, setting_name,
NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION
| (new_secrets ? NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW : 0));
g_object_set_data (G_OBJECT (applied_connection), WIRELESS_SECRETS_TRIES, GUINT_TO_POINTER (++tries));
g_object_set_qdata (G_OBJECT (applied_connection), wireless_secrets_tries_quark (), GUINT_TO_POINTER (++tries));
ret = NM_ACT_STAGE_RETURN_POSTPONE;
} else
_LOGW (LOGD_DEVICE, "Cleared secrets, but setting didn't need any secrets.");
@ -2895,7 +2895,7 @@ activation_success_handler (NMDevice *device)
nm_platform_wifi_indicate_addressing_running (NM_PLATFORM_GET, ifindex, FALSE);
/* Clear wireless secrets tries on success */
g_object_set_data (G_OBJECT (applied_connection), WIRELESS_SECRETS_TRIES, NULL);
g_object_set_qdata (G_OBJECT (applied_connection), wireless_secrets_tries_quark (), NULL);
/* There should always be a current AP, either a fake one because we haven't
* seen a scan result for the activated AP yet, or a real one from the
@ -2946,7 +2946,7 @@ activation_failure_handler (NMDevice *device)
g_assert (applied_connection);
/* Clear wireless secrets tries on failure */
g_object_set_data (G_OBJECT (applied_connection), WIRELESS_SECRETS_TRIES, NULL);
g_object_set_qdata (G_OBJECT (applied_connection), wireless_secrets_tries_quark (), NULL);
/* Clear any critical protocol notification in the wifi stack */
nm_platform_wifi_indicate_addressing_running (NM_PLATFORM_GET, nm_device_get_ifindex (device), FALSE);

View file

@ -77,8 +77,7 @@ typedef struct {
GArray *methods;
} NMExportedObjectClassInfo;
GQuark nm_exported_object_class_info_quark (void);
G_DEFINE_QUARK (NMExportedObjectClassInfo, nm_exported_object_class_info)
static NM_CACHED_QUARK_FCN ("NMExportedObjectClassInfo", nm_exported_object_class_info_quark)
/*****************************************************************************/
@ -388,8 +387,7 @@ nm_exported_object_meta_marshal (GClosure *closure, GValue *return_value,
g_free (local_param_values);
}
GQuark _skeleton_data_quark (void);
G_DEFINE_QUARK (skeleton-data, _skeleton_data);
static NM_CACHED_QUARK_FCN ("skeleton-data", _skeleton_data_quark)
typedef struct {
GBinding **prop_bindings;

View file

@ -86,7 +86,7 @@ static void device_sleep_cb (NMDevice *device,
GParamSpec *pspec,
NMManager *self);
#define TAG_ACTIVE_CONNETION_ADD_AND_ACTIVATE "act-con-add-and-activate"
static NM_CACHED_QUARK_FCN ("active-connection-add-and-activate", active_connection_add_and_activate_quark)
typedef struct {
gboolean user_enabled;
@ -233,8 +233,7 @@ NM_DEFINE_SINGLETON_INSTANCE (NMManager);
/*****************************************************************************/
GQuark autoconnect_root_quark (void);
G_DEFINE_QUARK (autoconnect-root, autoconnect_root);
static NM_CACHED_QUARK_FCN ("autoconnect-root", autoconnect_root_quark)
static void active_connection_state_changed (NMActiveConnection *active,
GParamSpec *pspec,
@ -3739,8 +3738,8 @@ _add_and_activate_auth_done (NMActiveConnection *active,
if (success) {
NMConnection *connection;
connection = g_object_steal_data (G_OBJECT (active),
TAG_ACTIVE_CONNETION_ADD_AND_ACTIVATE);
connection = g_object_steal_qdata (G_OBJECT (active),
active_connection_add_and_activate_quark ());
info = g_slice_new (AddAndActivateInfo);
info->manager = self;
@ -3855,10 +3854,10 @@ impl_manager_add_and_activate_connection (NMManager *self,
if (!active)
goto error;
g_object_set_data_full (G_OBJECT (active),
TAG_ACTIVE_CONNETION_ADD_AND_ACTIVATE,
connection,
g_object_unref);
g_object_set_qdata_full (G_OBJECT (active),
active_connection_add_and_activate_quark (),
connection,
g_object_unref);
nm_active_connection_authorize (active, connection, _add_and_activate_auth_done, self, context);
g_object_unref (subject);

View file

@ -57,7 +57,8 @@
#include "introspection/org.freedesktop.NetworkManager.PPP.h"
#define NM_PPPD_PLUGIN PPPD_PLUGIN_DIR "/nm-pppd-plugin.so"
#define PPP_MANAGER_SECRET_TRIES "ppp-manager-secret-tries"
static NM_CACHED_QUARK_FCN ("ppp-manager-secret-tries", ppp_manager_secret_tries_quark)
/*****************************************************************************/
@ -341,7 +342,7 @@ impl_ppp_manager_need_secrets (NMPPPManager *manager,
* appear to ask a few times when they actually don't even care what you
* pass back.
*/
tries = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (applied_connection), PPP_MANAGER_SECRET_TRIES));
tries = GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (applied_connection), ppp_manager_secret_tries_quark()));
if (tries > 1)
flags |= NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW;
@ -352,7 +353,7 @@ impl_ppp_manager_need_secrets (NMPPPManager *manager,
hints ? g_ptr_array_index (hints, 0) : NULL,
ppp_secrets_cb,
manager);
g_object_set_data (G_OBJECT (applied_connection), PPP_MANAGER_SECRET_TRIES, GUINT_TO_POINTER (++tries));
g_object_set_qdata (G_OBJECT (applied_connection), ppp_manager_secret_tries_quark (), GUINT_TO_POINTER (++tries));
priv->pending_secrets_context = context;
if (hints)
@ -389,7 +390,7 @@ set_ip_config_common (NMPPPManager *self,
/* Got successful IP config; obviously the secrets worked */
applied_connection = nm_act_request_get_applied_connection (priv->act_req);
g_object_set_data (G_OBJECT (applied_connection), PPP_MANAGER_SECRET_TRIES, NULL);
g_object_set_qdata (G_OBJECT (applied_connection), ppp_manager_secret_tries_quark (), NULL);
if (out_mtu) {
/* Get any custom MTU */

View file

@ -104,7 +104,7 @@ EXPORT(nm_settings_connection_replace_and_commit)
#define IFCFG_DIR SYSCONFDIR "/sysconfig/network"
#define CONF_DHCP IFCFG_DIR "/dhcp"
#define PLUGIN_MODULE_PATH "plugin-module-path"
static NM_CACHED_QUARK_FCN ("plugin-module-path", plugin_module_path_quark)
#if (defined(HOSTNAME_PERSIST_SUSE) + defined(HOSTNAME_PERSIST_SLACKWARE) + defined(HOSTNAME_PERSIST_GENTOO)) > 1
#error "Can only define one of HOSTNAME_PERSIST_*"
@ -120,6 +120,9 @@ EXPORT(nm_settings_connection_replace_and_commit)
#define HOSTNAME_FILE HOSTNAME_FILE_DEFAULT
#endif
static NM_CACHED_QUARK_FCN ("default-wired-connection", _default_wired_connection_quark)
static NM_CACHED_QUARK_FCN ("default-wired-device", _default_wired_device_quark)
/*****************************************************************************/
NM_GOBJECT_PROPERTIES_DEFINE (NMSettings,
@ -753,7 +756,7 @@ add_plugin (NMSettings *self, NMSettingsPlugin *plugin)
NM_SETTINGS_PLUGIN_INFO, &pinfo,
NULL);
path = g_object_get_data (G_OBJECT (plugin), PLUGIN_MODULE_PATH);
path = g_object_get_qdata (G_OBJECT (plugin), plugin_module_path_quark ());
_LOGI ("loaded plugin %s: %s%s%s%s", pname, pinfo,
NM_PRINT_FMT_QUOTED (path, " (", path, ")", ""));
@ -916,7 +919,7 @@ load_plugin:
break;
}
g_object_set_data_full (obj, PLUGIN_MODULE_PATH, path, g_free);
g_object_set_qdata_full (obj, plugin_module_path_quark (), path, g_free);
path = NULL;
if (add_plugin (self, NM_SETTINGS_PLUGIN (obj)))
list = g_slist_append (list, obj);
@ -1935,9 +1938,6 @@ have_connection_for_device (NMSettings *self, NMDevice *device)
return FALSE;
}
#define DEFAULT_WIRED_CONNECTION_TAG "default-wired-connection"
#define DEFAULT_WIRED_DEVICE_TAG "default-wired-device"
static void default_wired_clear_tag (NMSettings *self,
NMDevice *device,
NMSettingsConnection *connection,
@ -1953,7 +1953,7 @@ default_wired_connection_removed_cb (NMSettingsConnection *connection, NMSetting
* wired device to the config file and don't create a new default wired
* connection for that device again.
*/
device = g_object_get_data (G_OBJECT (connection), DEFAULT_WIRED_DEVICE_TAG);
device = g_object_get_qdata (G_OBJECT (connection), _default_wired_device_quark ());
if (device)
default_wired_clear_tag (self, device, connection, TRUE);
}
@ -1970,7 +1970,7 @@ default_wired_connection_updated_by_user_cb (NMSettingsConnection *connection, g
* considered a default wired connection, and should no longer affect
* the no-auto-default configuration option.
*/
device = g_object_get_data (G_OBJECT (connection), DEFAULT_WIRED_DEVICE_TAG);
device = g_object_get_qdata (G_OBJECT (connection), _default_wired_device_quark ());
if (device)
default_wired_clear_tag (self, device, connection, FALSE);
}
@ -1984,11 +1984,11 @@ default_wired_clear_tag (NMSettings *self,
g_return_if_fail (NM_IS_SETTINGS (self));
g_return_if_fail (NM_IS_DEVICE (device));
g_return_if_fail (NM_IS_CONNECTION (connection));
g_return_if_fail (device == g_object_get_data (G_OBJECT (connection), DEFAULT_WIRED_DEVICE_TAG));
g_return_if_fail (connection == g_object_get_data (G_OBJECT (device), DEFAULT_WIRED_CONNECTION_TAG));
g_return_if_fail (device == g_object_get_qdata (G_OBJECT (connection), _default_wired_device_quark ()));
g_return_if_fail (connection == g_object_get_qdata (G_OBJECT (device), _default_wired_connection_quark ()));
g_object_set_data (G_OBJECT (connection), DEFAULT_WIRED_DEVICE_TAG, NULL);
g_object_set_data (G_OBJECT (device), DEFAULT_WIRED_CONNECTION_TAG, NULL);
g_object_set_qdata (G_OBJECT (connection), _default_wired_device_quark (), NULL);
g_object_set_qdata (G_OBJECT (device), _default_wired_connection_quark (), NULL);
g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (default_wired_connection_removed_cb), self);
g_signal_handlers_disconnect_by_func (connection, G_CALLBACK (default_wired_connection_updated_by_user_cb), self);
@ -2015,7 +2015,7 @@ device_realized (NMDevice *device, GParamSpec *pspec, NMSettings *self)
* ignore it.
*/
if ( !nm_device_get_managed (device, FALSE)
|| g_object_get_data (G_OBJECT (device), DEFAULT_WIRED_CONNECTION_TAG)
|| g_object_get_qdata (G_OBJECT (device), _default_wired_connection_quark ())
|| have_connection_for_device (self, device))
return;
@ -2037,8 +2037,8 @@ device_realized (NMDevice *device, GParamSpec *pspec, NMSettings *self)
return;
}
g_object_set_data (G_OBJECT (added), DEFAULT_WIRED_DEVICE_TAG, device);
g_object_set_data (G_OBJECT (device), DEFAULT_WIRED_CONNECTION_TAG, added);
g_object_set_qdata (G_OBJECT (added), _default_wired_device_quark (), device);
g_object_set_qdata (G_OBJECT (device), _default_wired_connection_quark (), added);
g_signal_connect (added, NM_SETTINGS_CONNECTION_UPDATED_INTERNAL,
G_CALLBACK (default_wired_connection_updated_by_user_cb), self);
@ -2071,7 +2071,7 @@ nm_settings_device_removed (NMSettings *self, NMDevice *device, gboolean quittin
G_CALLBACK (device_realized),
self);
connection = g_object_get_data (G_OBJECT (device), DEFAULT_WIRED_CONNECTION_TAG);
connection = g_object_get_qdata (G_OBJECT (device), _default_wired_connection_quark ());
if (connection) {
default_wired_clear_tag (self, device, connection, FALSE);

View file

@ -37,6 +37,8 @@
#define WPAS_ERROR_INVALID_IFACE WPAS_DBUS_INTERFACE ".InvalidInterface"
#define WPAS_ERROR_EXISTS_ERROR WPAS_DBUS_INTERFACE ".InterfaceExists"
static NM_CACHED_QUARK_FCN ("bss-proxy-inited", bss_proxy_inited_quark)
/*****************************************************************************/
enum {
@ -177,8 +179,6 @@ _get_bss_proxy_properties (NMSupplicantInterface *self, GDBusProxy *proxy)
return g_variant_builder_end (&builder);
}
#define BSS_PROXY_INITED "bss-proxy-inited"
static void
on_bss_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_data)
{
@ -201,7 +201,7 @@ on_bss_proxy_acquired (GDBusProxy *proxy, GAsyncResult *result, gpointer user_da
if (!props)
return;
g_object_set_data (G_OBJECT (proxy), BSS_PROXY_INITED, GUINT_TO_POINTER (TRUE));
g_object_set_qdata (G_OBJECT (proxy), bss_proxy_inited_quark (), GUINT_TO_POINTER (TRUE));
g_signal_emit (self, signals[NEW_BSS], 0,
g_dbus_proxy_get_object_path (proxy),
@ -567,7 +567,7 @@ wpas_iface_scan_done (GDBusProxy *proxy,
/* Emit NEW_BSS so that wifi device has the APs (in case it removed them) */
g_hash_table_iter_init (&iter, priv->bss_proxies);
while (g_hash_table_iter_next (&iter, (gpointer) &bss_path, (gpointer) &bss_proxy)) {
if (g_object_get_data (G_OBJECT (bss_proxy), BSS_PROXY_INITED)) {
if (g_object_get_qdata (G_OBJECT (bss_proxy), bss_proxy_inited_quark ())) {
props = _get_bss_proxy_properties (self, bss_proxy);
if (props) {
g_signal_emit (self, signals[NEW_BSS], 0,

View file

@ -63,7 +63,7 @@ G_DEFINE_TYPE (NMSupplicantManager, nm_supplicant_manager, G_TYPE_OBJECT)
/*****************************************************************************/
G_DEFINE_QUARK (nm-supplicant-error-quark, nm_supplicant_error);
NM_CACHED_QUARK_FCN ("nm-supplicant-error-quark", nm_supplicant_error_quark)
/*****************************************************************************/