summaryrefslogtreecommitdiffstats
path: root/network
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-10-04 13:22:20 +0200
committerJohan Hedberg <johan.hedberg@nokia.com>2008-10-04 13:22:20 +0200
commitb33d56deeac1577b2e87f604ab86139c19b05967 (patch)
treeed45a1852641bdcec8578272246f65292cb333e8 /network
parent79c4a0e6df03808898cf3c1b592a02e5585c6bc9 (diff)
Remove uninitialized variable compiler warning with some gcc versions
Diffstat (limited to 'network')
-rw-r--r--network/connection.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/network/connection.c b/network/connection.c
index a8dd5689..08766db4 100644
--- a/network/connection.c
+++ b/network/connection.c
@@ -445,7 +445,7 @@ static DBusMessage *connection_get_properties(DBusConnection *conn,
DBusMessage *msg, void *data)
{
struct network_peer *peer = data;
- struct network_conn *nc;
+ struct network_conn *nc = NULL;
DBusMessage *reply;
DBusMessageIter iter;
DBusMessageIter dict;
@@ -466,22 +466,26 @@ static DBusMessage *connection_get_properties(DBusConnection *conn,
/* Connected */
for (l = peer->connections; l; l = l->next) {
- nc = l->data;
+ struct network_conn *tmp = l->data;
+
+ if (tmp->state != CONNECTED)
+ continue;
- if (nc->state == CONNECTED)
- break;
+ nc = tmp;
+ break;
}
- connected = (l != NULL);
+
+ connected = nc ? TRUE : FALSE;
dbus_message_iter_append_dict_entry(&dict, "Connected",
DBUS_TYPE_BOOLEAN, &connected);
/* Device */
- property = connected ? nc->dev : "";
+ property = nc ? nc->dev : "";
dbus_message_iter_append_dict_entry(&dict, "Device",
DBUS_TYPE_STRING, &property);
/* UUID */
- property = connected ? bnep_uuid(nc->id) : "";
+ property = nc ? bnep_uuid(nc->id) : "";
dbus_message_iter_append_dict_entry(&dict, "UUID",
DBUS_TYPE_STRING, &property);