Mercurial > pidgin.yaz
changeset 32042:f762bcb55249
jabber/caps: Reorganize for the purpose of making clang's analyzer happier
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Wed, 11 May 2011 04:20:12 +0000 |
parents | dec74c97c598 |
children | 9449f70762e7 |
files | libpurple/protocols/jabber/caps.c |
diffstat | 1 files changed, 24 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- 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); } }