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:
@@ -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));
|
||||
|
Reference in New Issue
Block a user