xmllite: Use a helper to move to first attribute to avoid extra traces.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2016-12-09 16:38:26 +03:00 committed by Alexandre Julliard
parent 65ee2b734a
commit 0575a4b2bb
1 changed files with 15 additions and 7 deletions

View File

@ -2790,18 +2790,26 @@ static HRESULT WINAPI xmlreader_GetNodeType(IXmlReader* iface, XmlNodeType *node
return This->state == XmlReadState_Closed ? S_FALSE : S_OK;
}
static HRESULT reader_move_to_first_attribute(xmlreader *reader)
{
if (!reader->attr_count)
return S_FALSE;
reader->attr = LIST_ENTRY(list_head(&reader->attrs), struct attribute, entry);
reader_set_strvalue(reader, StringValue_Prefix, &reader->attr->prefix);
reader_set_strvalue(reader, StringValue_LocalName, &reader->attr->localname);
reader_set_strvalue(reader, StringValue_Value, &reader->attr->value);
return S_OK;
}
static HRESULT WINAPI xmlreader_MoveToFirstAttribute(IXmlReader* iface)
{
xmlreader *This = impl_from_IXmlReader(iface);
TRACE("(%p)\n", This);
if (!This->attr_count) return S_FALSE;
This->attr = LIST_ENTRY(list_head(&This->attrs), struct attribute, entry);
reader_set_strvalue(This, StringValue_LocalName, &This->attr->localname);
reader_set_strvalue(This, StringValue_Value, &This->attr->value);
return S_OK;
return reader_move_to_first_attribute(This);
}
static HRESULT WINAPI xmlreader_MoveToNextAttribute(IXmlReader* iface)
@ -2814,7 +2822,7 @@ static HRESULT WINAPI xmlreader_MoveToNextAttribute(IXmlReader* iface)
if (!This->attr_count) return S_FALSE;
if (!This->attr)
return IXmlReader_MoveToFirstAttribute(iface);
return reader_move_to_first_attribute(This);
next = list_next(&This->attrs, &This->attr->entry);
if (next)