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

Alexandre Julliard julliard at winehq.org
Fri Dec 9 13:37:34 CST 2016


Module: wine
Branch: master
Commit: 0575a4b2bb28318eb763088bddb159fc03775418
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0575a4b2bb28318eb763088bddb159fc03775418

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Dec  9 16:38:26 2016 +0300

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

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/xmllite/reader.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/dlls/xmllite/reader.c b/dlls/xmllite/reader.c
index 351f872..874de75 100644
--- a/dlls/xmllite/reader.c
+++ b/dlls/xmllite/reader.c
@@ -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)




More information about the wine-cvs mailing list