# HG changeset patch # User Paul Aurich # Date 1305087612 0 # Node ID f762bcb55249354d77796a363d9b137dd178aa1b # Parent dec74c97c598af27be43a1295a22c84487b17908 jabber/caps: Reorganize for the purpose of making clang's analyzer happier diff -r dec74c97c598 -r f762bcb55249 libpurple/protocols/jabber/caps.c --- a/libpurple/protocols/jabber/caps.c Wed May 11 02:42:52 2011 +0000 +++ b/libpurple/protocols/jabber/caps.c Wed May 11 04:20:12 2011 +0000 @@ -285,34 +285,36 @@ * work properly, that bug needs to be fixed in * xmlnode_from_str, not the output version... */ value->forms = g_list_append(value->forms, xmlnode_copy(child)); - } else if (g_str_equal(child->name, "ext") && key->hash != NULL) { - purple_debug_warning("jabber", "Ignoring exts when reading new-style caps\n"); } else if (g_str_equal(child->name, "ext")) { - /* TODO: Do we care about reading in the identities listed here? */ - const char *identifier = xmlnode_get_attrib(child, "identifier"); - xmlnode *node; - GList *features = NULL; + if (key->hash != NULL) + purple_debug_warning("jabber", "Ignoring exts when reading new-style caps\n"); + else { + /* TODO: Do we care about reading in the identities listed here? */ + const char *identifier = xmlnode_get_attrib(child, "identifier"); + xmlnode *node; + GList *features = NULL; - if (!identifier) - continue; - - for (node = child->child; node; node = node->next) { - if (node->type != XMLNODE_TYPE_TAG) + if (!identifier) continue; - if (g_str_equal(node->name, "feature")) { - const char *var = xmlnode_get_attrib(node, "var"); - if (!var) + + for (node = child->child; node; node = node->next) { + if (node->type != XMLNODE_TYPE_TAG) continue; - features = g_list_prepend(features, g_strdup(var)); + if (g_str_equal(node->name, "feature")) { + const char *var = xmlnode_get_attrib(node, "var"); + if (!var) + continue; + features = g_list_prepend(features, g_strdup(var)); + } } + + if (features) { + g_hash_table_insert(exts->exts, g_strdup(identifier), + features); + } else + purple_debug_warning("jabber", "Caps ext %s had no features.\n", + identifier); } - - if (features) { - g_hash_table_insert(exts->exts, g_strdup(identifier), - features); - } else - purple_debug_warning("jabber", "Caps ext %s had no features.\n", - identifier); } }