X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=avahi-client%2Fentrygroup.c;h=162f2c4e003a0bd1403722a5ff2ce34046b39cfc;hb=df28cc51c00a958d25f7ebd7b5b0d7fb9af0b8e1;hp=e94001b796f85022754ddb5e4b080d2cc474db89;hpb=2be7dc13cecbb995692eec1bfc1d27799651ec70;p=catta diff --git a/avahi-client/entrygroup.c b/avahi-client/entrygroup.c index e94001b..162f2c4 100644 --- a/avahi-client/entrygroup.c +++ b/avahi-client/entrygroup.c @@ -51,7 +51,7 @@ void avahi_entry_group_set_state(AvahiEntryGroup *group, AvahiEntryGroupState st } static int retrieve_state(AvahiEntryGroup *group) { - DBusMessage *message, *reply; + DBusMessage *message = NULL, *reply = NULL; DBusError error; int r = AVAHI_OK; int32_t state; @@ -111,7 +111,7 @@ AvahiEntryGroup* avahi_entry_group_new (AvahiClient *client, AvahiEntryGroupCall dbus_error_init (&error); - if (client->state == AVAHI_CLIENT_DISCONNECTED) { + if (!avahi_client_is_connected(client)) { avahi_client_set_errno(client, AVAHI_ERR_BAD_STATE); goto fail; } @@ -237,7 +237,7 @@ int avahi_entry_group_free(AvahiEntryGroup *group) { assert(group); - if (group->path && client->state != AVAHI_CLIENT_DISCONNECTED) + if (group->path && !avahi_client_is_connected(client)) r = entry_group_simple_method_call(group, "Free"); AVAHI_LLIST_REMOVE(AvahiEntryGroup, groups, client->groups, group); @@ -251,7 +251,7 @@ int avahi_entry_group_free(AvahiEntryGroup *group) { int avahi_entry_group_commit(AvahiEntryGroup *group) { assert(group); - if (!group->path || group->client->state == AVAHI_CLIENT_DISCONNECTED) + if (!group->path || !avahi_client_is_connected(group->client)) return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE); return entry_group_simple_method_call(group, "Commit"); @@ -260,7 +260,7 @@ int avahi_entry_group_commit(AvahiEntryGroup *group) { int avahi_entry_group_reset(AvahiEntryGroup *group) { assert(group); - if (!group->path || group->client->state == AVAHI_CLIENT_DISCONNECTED) + if (!group->path || !avahi_client_is_connected(group->client)) return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE); return entry_group_simple_method_call(group, "Reset"); @@ -279,7 +279,7 @@ AvahiClient* avahi_entry_group_get_client (AvahiEntryGroup *group) { } int avahi_entry_group_is_empty (AvahiEntryGroup *group) { - DBusMessage *message, *reply; + DBusMessage *message = NULL, *reply = NULL; DBusError error; int r = AVAHI_OK; int b; @@ -288,7 +288,7 @@ int avahi_entry_group_is_empty (AvahiEntryGroup *group) { assert(group); client = group->client; - if (!group->path || group->client->state == AVAHI_CLIENT_DISCONNECTED) + if (!group->path || !avahi_client_is_connected(group->client)) return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE); dbus_error_init(&error); @@ -409,7 +409,7 @@ int avahi_entry_group_add_service_strlst( client = group->client; - if (!group->path || group->client->state == AVAHI_CLIENT_DISCONNECTED) + if (!group->path || !avahi_client_is_connected(group->client)) return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE); if (!domain) @@ -528,7 +528,7 @@ int avahi_entry_group_add_service_subtype( client = group->client; - if (!group->path || group->client->state == AVAHI_CLIENT_DISCONNECTED) + if (!group->path || !avahi_client_is_connected(group->client)) return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE); if (!domain) @@ -638,7 +638,7 @@ int avahi_entry_group_update_service_txt_strlst( client = group->client; - if (!group->path || group->client->state == AVAHI_CLIENT_DISCONNECTED) + if (!group->path || !avahi_client_is_connected(group->client)) return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE); if (!domain) @@ -700,8 +700,6 @@ fail: dbus_message_unref(reply); return r; - - } /** Add a host/address pair */ @@ -726,7 +724,7 @@ int avahi_entry_group_add_address( client = group->client; - if (!group->path || group->client->state == AVAHI_CLIENT_DISCONNECTED) + if (!group->path || !avahi_client_is_connected(group->client)) return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE); dbus_error_init(&error); @@ -815,7 +813,7 @@ int avahi_entry_group_add_record( client = group->client; - if (!group->path || group->client->state == AVAHI_CLIENT_DISCONNECTED) + if (!group->path || !avahi_client_is_connected(group->client)) return avahi_client_set_errno(group->client, AVAHI_ERR_BAD_STATE); dbus_error_init(&error);