2006-03-09 Robert Love <rml@novell.com>

* src/NetworkManagerAP.c, src/NetworkManagerAP.h: Have the function
	  nm_ap_set_timestamp() take the second and micro-second parameters as
	  direct arguments, which avoids both a dynamic memory allocation and a
	  structure-to-structure copy!  Add a new interface, the aptly named
	  nm_ap_set_timestamp_via_timestamp(), to set the timestamp from an
	  existing GTimeVal, as nm_ap_set_timestamp() once did, for use with
	  the return from nm_ap_get_timestamp().  New users should use the new
	  nm_ap_set_timestamp(), not nm_ap_set_timestamp_via_timestamp(), for
	  the extreme benefit to performance.
	* src/NetworkManagerAPList.c, src/nm-dbus-nmi.c,
	  src/backends/NetworkManagerSuSE.c: Use the new functions as needed.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1569 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Robert Love
2006-03-09 15:24:30 +00:00
committed by Robert Love
parent c29161e537
commit 16ad005600
6 changed files with 31 additions and 20 deletions

View File

@@ -1,3 +1,17 @@
2006-03-09 Robert Love <rml@novell.com>
* src/NetworkManagerAP.c, src/NetworkManagerAP.h: Have the function
nm_ap_set_timestamp() take the second and micro-second parameters as
direct arguments, which avoids both a dynamic memory allocation and a
structure-to-structure copy! Add a new interface, the aptly named
nm_ap_set_timestamp_via_timestamp(), to set the timestamp from an
existing GTimeVal, as nm_ap_set_timestamp() once did, for use with
the return from nm_ap_get_timestamp(). New users should use the new
nm_ap_set_timestamp(), not nm_ap_set_timestamp_via_timestamp(), for
the extreme benefit to performance.
* src/NetworkManagerAPList.c, src/nm-dbus-nmi.c,
src/backends/NetworkManagerSuSE.c: Use the new functions as needed.
2006-03-08 Robert Love <rml@novell.com>
* gnome/applet/applet.glade: Hide the password entry text with

View File

@@ -171,14 +171,21 @@ const GTimeVal *nm_ap_get_timestamp (const NMAccessPoint *ap)
return (&ap->timestamp);
}
void nm_ap_set_timestamp (NMAccessPoint *ap, const GTimeVal *timestamp)
void nm_ap_set_timestamp (NMAccessPoint *ap, glong sec, glong usec)
{
g_return_if_fail (ap != NULL);
ap->timestamp.tv_sec = sec;
ap->timestamp.tv_usec = usec;
}
void nm_ap_set_timestamp_via_timestamp (NMAccessPoint *ap, const GTimeVal *timestamp)
{
g_return_if_fail (ap != NULL);
ap->timestamp = *timestamp;
}
/*
* Get/set functions for essid
*

View File

@@ -38,7 +38,8 @@ void nm_ap_unref (NMAccessPoint *ap);
void nm_ap_ref (NMAccessPoint *ap);
const GTimeVal * nm_ap_get_timestamp (const NMAccessPoint *ap);
void nm_ap_set_timestamp (NMAccessPoint *ap, const GTimeVal *timestamp);
void nm_ap_set_timestamp (NMAccessPoint *ap, glong sec, glong usec);
void nm_ap_set_timestamp_via_timestamp (NMAccessPoint *ap, const GTimeVal *timestamp);
const char * nm_ap_get_essid (const NMAccessPoint *ap);
void nm_ap_set_essid (NMAccessPoint *ap, const char *essid);

View File

@@ -573,7 +573,7 @@ void nm_ap_list_copy_properties (NMAccessPointList *dest, NMAccessPointList *sou
{
nm_ap_set_invalid (dest_ap, nm_ap_get_invalid (src_ap));
nm_ap_set_security (dest_ap, nm_ap_get_security (src_ap));
nm_ap_set_timestamp (dest_ap, nm_ap_get_timestamp (src_ap));
nm_ap_set_timestamp_via_timestamp (dest_ap, nm_ap_get_timestamp (src_ap));
}
}
nm_ap_list_iter_free (iter);

View File

@@ -518,7 +518,6 @@ found:
NMAccessPoint * ap;
NMAccessPoint * list_ap;
NMAPSecurity * security;
GTimeVal * timestamp;
ap = nm_ap_new ();
security = nm_ap_security_new (IW_AUTH_CIPHER_NONE);
@@ -527,18 +526,13 @@ found:
nm_ap_set_security (ap, security);
g_object_unref (G_OBJECT (security)); /* set_security copies the object */
timestamp = g_malloc0 (sizeof (GTimeVal));
timestamp->tv_sec = time (NULL);
timestamp->tv_usec = 0;
nm_ap_set_timestamp (ap, timestamp);
g_free (timestamp);
nm_ap_set_timestamp (ap, time (NULL), 0);
nm_ap_set_trusted (ap, TRUE);
if ((list_ap = nm_ap_list_get_ap_by_essid (app_data->allowed_ap_list, buf)))
{
nm_ap_set_essid (list_ap, nm_ap_get_essid (ap));
nm_ap_set_timestamp (list_ap, nm_ap_get_timestamp (ap));
nm_ap_set_timestamp_via_timestamp (list_ap, nm_ap_get_timestamp (ap));
nm_ap_set_trusted (list_ap, nm_ap_get_trusted (ap));
nm_ap_set_security (list_ap, nm_ap_get_security (ap));
nm_ap_set_user_addresses (list_ap, nm_ap_get_user_addresses (ap));

View File

@@ -346,7 +346,6 @@ static void nm_dbus_get_network_data_cb (DBusPendingCall *pcall, void *user_data
NMAPSecurity * security;
NMAccessPoint * ap;
NMAccessPoint * list_ap;
GTimeVal * timestamp;
g_return_if_fail (pcall != NULL);
g_return_if_fail (cb_data != NULL);
@@ -448,11 +447,7 @@ static void nm_dbus_get_network_data_cb (DBusPendingCall *pcall, void *user_data
nm_ap_set_security (ap, security);
g_object_unref (G_OBJECT (security)); /* set_security copies the object */
timestamp = g_malloc0 (sizeof (GTimeVal));
timestamp->tv_sec = timestamp_secs;
timestamp->tv_usec = 0;
nm_ap_set_timestamp (ap, timestamp);
g_free (timestamp);
nm_ap_set_timestamp (ap, timestamp_secs, 0);
nm_ap_set_trusted (ap, trusted);
nm_ap_set_user_addresses (ap, addr_list);
@@ -460,7 +455,7 @@ static void nm_dbus_get_network_data_cb (DBusPendingCall *pcall, void *user_data
if ((list_ap = nm_ap_list_get_ap_by_essid (cb_data->list, essid)))
{
nm_ap_set_essid (list_ap, nm_ap_get_essid (ap));
nm_ap_set_timestamp (list_ap, nm_ap_get_timestamp (ap));
nm_ap_set_timestamp_via_timestamp (list_ap, nm_ap_get_timestamp (ap));
nm_ap_set_trusted (list_ap, nm_ap_get_trusted (ap));
nm_ap_set_security (list_ap, nm_ap_get_security (ap));
nm_ap_set_user_addresses (list_ap, nm_ap_get_user_addresses (ap));