NetworkManager r3548 - in trunk: . libnm-glib libnm-util src/dhcp-manager system-settings/plugins/ifcfg-fedora system-settings/plugins/ifcfg-suse system-settings/src
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r3548 - in trunk: . libnm-glib libnm-util src/dhcp-manager system-settings/plugins/ifcfg-fedora system-settings/plugins/ifcfg-suse system-settings/src
- Date: Tue, 8 Apr 2008 22:15:45 +0100 (BST)
Author: dcbw
Date: Tue Apr 8 22:15:45 2008
New Revision: 3548
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3548&view=rev
Log:
2008-04-08 Dan Williams <dcbw redhat com>
* libnm-glib/nm-object-cache.c
libnm-glib/nm-settings.c
src/dhcp-manager/nm-dhcp-manager.c
system-settings/plugins/ifcfg-fedora/plugin.c
system-settings/plugins/ifcfg-suse/plugin.c
system-settings/src/nm-system-config-hal-manager.c
libnm-util/nm-utils.c
- Remove usage of GStaticMutex since gcc-4.3 hates it and because we're
not threadsafe anyway
Modified:
trunk/ChangeLog
trunk/libnm-glib/nm-object-cache.c
trunk/libnm-glib/nm-settings.c
trunk/libnm-util/nm-utils.c
trunk/src/dhcp-manager/nm-dhcp-manager.c
trunk/system-settings/plugins/ifcfg-fedora/plugin.c
trunk/system-settings/plugins/ifcfg-suse/plugin.c
trunk/system-settings/src/nm-system-config-hal-manager.c
Modified: trunk/libnm-glib/nm-object-cache.c
==============================================================================
--- trunk/libnm-glib/nm-object-cache.c (original)
+++ trunk/libnm-glib/nm-object-cache.c Tue Apr 8 22:15:45 2008
@@ -25,7 +25,6 @@
#include "nm-object-cache.h"
#include "nm-object.h"
-static GStaticMutex cache_mutex = G_STATIC_MUTEX_INIT;
static GHashTable *cache = NULL;
static void
@@ -38,19 +37,15 @@
void
nm_object_cache_remove_by_path (const char *path)
{
- g_static_mutex_lock (&cache_mutex);
_init_cache ();
g_hash_table_remove (cache, path);
- g_static_mutex_unlock (&cache_mutex);
}
void
nm_object_cache_remove_by_object (NMObject *object)
{
- g_static_mutex_lock (&cache_mutex);
_init_cache ();
g_hash_table_remove (cache, nm_object_get_path (object));
- g_static_mutex_unlock (&cache_mutex);
}
void
@@ -58,13 +53,11 @@
{
char *path;
- g_static_mutex_lock (&cache_mutex);
_init_cache ();
path = g_strdup (nm_object_get_path (object));
g_hash_table_insert (cache, path, object);
g_object_set_data_full (G_OBJECT (object), "nm-object-cache-tag",
path, (GDestroyNotify) nm_object_cache_remove_by_path);
- g_static_mutex_unlock (&cache_mutex);
}
NMObject *
@@ -72,10 +65,8 @@
{
NMObject *object;
- g_static_mutex_lock (&cache_mutex);
_init_cache ();
object = g_hash_table_lookup (cache, path);
- g_static_mutex_unlock (&cache_mutex);
return object;
}
Modified: trunk/libnm-glib/nm-settings.c
==============================================================================
--- trunk/libnm-glib/nm-settings.c (original)
+++ trunk/libnm-glib/nm-settings.c Tue Apr 8 22:15:45 2008
@@ -350,7 +350,6 @@
DBusGConnection *dbus_connection)
{
NMExportedConnectionPrivate *priv;
- static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
static guint32 ec_counter = 0;
char *path;
@@ -359,10 +358,7 @@
priv = NM_EXPORTED_CONNECTION_GET_PRIVATE (connection);
- g_static_mutex_lock (&mutex);
path = g_strdup_printf ("%s/%u", NM_DBUS_PATH_SETTINGS, ec_counter++);
- g_static_mutex_unlock (&mutex);
-
nm_connection_set_path (priv->wrapped, path);
nm_connection_set_scope (priv->wrapped, scope);
Modified: trunk/libnm-util/nm-utils.c
==============================================================================
--- trunk/libnm-util/nm-utils.c (original)
+++ trunk/libnm-util/nm-utils.c Tue Apr 8 22:15:45 2008
@@ -124,33 +124,29 @@
static void
init_lang_to_encodings_hash (void)
{
- static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
-
- g_static_mutex_lock (&mutex);
- if (G_UNLIKELY (!langToEncodings5 || !langToEncodings2))
- {
- const struct IsoLangToEncodings * enc = &isoLangEntries5[0];
+ struct IsoLangToEncodings *enc;
+ if (G_UNLIKELY (langToEncodings5 == NULL)) {
/* Five-letter codes */
+ enc = (struct IsoLangToEncodings *) &isoLangEntries5[0];
langToEncodings5 = g_hash_table_new (g_str_hash, g_str_equal);
- while (enc->lang)
- {
+ while (enc->lang) {
g_hash_table_insert (langToEncodings5, (gpointer) enc->lang,
(gpointer) &enc->encodings);
enc++;
}
+ }
+ if (G_UNLIKELY (langToEncodings2 == NULL)) {
/* Two-letter codes */
- enc = &isoLangEntries2[0];
+ enc = (struct IsoLangToEncodings *) &isoLangEntries2[0];
langToEncodings2 = g_hash_table_new (g_str_hash, g_str_equal);
- while (enc->lang)
- {
+ while (enc->lang) {
g_hash_table_insert (langToEncodings2, (gpointer) enc->lang,
(gpointer) &enc->encodings);
enc++;
}
}
- g_static_mutex_unlock (&mutex);
}
Modified: trunk/src/dhcp-manager/nm-dhcp-manager.c
==============================================================================
--- trunk/src/dhcp-manager/nm-dhcp-manager.c (original)
+++ trunk/src/dhcp-manager/nm-dhcp-manager.c Tue Apr 8 22:15:45 2008
@@ -121,14 +121,11 @@
NMDHCPManager *
nm_dhcp_manager_get (void)
{
- static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
static NMDHCPManager *singleton = NULL;
- g_static_mutex_lock (&mutex);
if (!singleton)
singleton = nm_dhcp_manager_new ();
g_object_ref (singleton);
- g_static_mutex_unlock (&mutex);
return singleton;
}
Modified: trunk/system-settings/plugins/ifcfg-fedora/plugin.c
==============================================================================
--- trunk/system-settings/plugins/ifcfg-fedora/plugin.c (original)
+++ trunk/system-settings/plugins/ifcfg-fedora/plugin.c Tue Apr 8 22:15:45 2008
@@ -989,14 +989,12 @@
G_MODULE_EXPORT GObject *
nm_system_config_factory (void)
{
- static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
static SCPluginIfcfg *singleton = NULL;
- g_static_mutex_lock (&mutex);
if (!singleton)
singleton = SC_PLUGIN_IFCFG (g_object_new (SC_TYPE_PLUGIN_IFCFG, NULL));
- g_object_ref (singleton);
- g_static_mutex_unlock (&mutex);
+ else
+ g_object_ref (singleton);
return G_OBJECT (singleton);
}
Modified: trunk/system-settings/plugins/ifcfg-suse/plugin.c
==============================================================================
--- trunk/system-settings/plugins/ifcfg-suse/plugin.c (original)
+++ trunk/system-settings/plugins/ifcfg-suse/plugin.c Tue Apr 8 22:15:45 2008
@@ -425,14 +425,12 @@
G_MODULE_EXPORT GObject *
nm_system_config_factory (void)
{
- static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
static SCPluginIfcfg *singleton = NULL;
- g_static_mutex_lock (&mutex);
if (!singleton)
singleton = SC_PLUGIN_IFCFG (g_object_new (SC_TYPE_PLUGIN_IFCFG, NULL));
- g_object_ref (singleton);
- g_static_mutex_unlock (&mutex);
+ else
+ g_object_ref (singleton);
return G_OBJECT (singleton);
}
Modified: trunk/system-settings/src/nm-system-config-hal-manager.c
==============================================================================
--- trunk/system-settings/src/nm-system-config-hal-manager.c (original)
+++ trunk/system-settings/src/nm-system-config-hal-manager.c Tue Apr 8 22:15:45 2008
@@ -260,15 +260,12 @@
NMSystemConfigHalManager *
nm_system_config_hal_manager_get (DBusGConnection *g_connection)
{
- static GStaticMutex mutex = G_STATIC_MUTEX_INIT;
static NMSystemConfigHalManager *singleton = NULL;
- g_static_mutex_lock (&mutex);
if (!singleton)
singleton = nm_system_config_hal_manager_new (g_connection);
else
g_object_ref (singleton);
- g_static_mutex_unlock (&mutex);
return singleton;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]