Nikolay Sivov : xmllite: Use ARRAY_SIZE macro for reader too.

Alexandre Julliard julliard at winehq.org
Thu Feb 22 15:07:46 CST 2018


Module: wine
Branch: master
Commit: 4a78b4da4136fada4786d5d39cedc453c696436a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=4a78b4da4136fada4786d5d39cedc453c696436a

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Thu Feb 22 09:01:43 2018 +0300

xmllite: Use ARRAY_SIZE macro for reader too.

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

---

 dlls/xmllite/reader.c          | 8 ++++----
 dlls/xmllite/writer.c          | 2 --
 dlls/xmllite/xmllite_private.h | 2 ++
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/xmllite/reader.c b/dlls/xmllite/reader.c
index 495d4e3..9cb7f3b 100644
--- a/dlls/xmllite/reader.c
+++ b/dlls/xmllite/reader.c
@@ -168,7 +168,7 @@ const WCHAR *get_encoding_name(xml_encoding encoding)
 xml_encoding get_encoding_from_codepage(UINT codepage)
 {
     int i;
-    for (i = 0; i < sizeof(xml_encoding_map)/sizeof(xml_encoding_map[0]); i++)
+    for (i = 0; i < ARRAY_SIZE(xml_encoding_map); i++)
     {
         if (xml_encoding_map[i].cp == codepage) return xml_encoding_map[i].enc;
     }
@@ -749,7 +749,7 @@ xml_encoding parse_encoding_name(const WCHAR *name, int len)
     if (!name) return XmlEncoding_Unknown;
 
     min = 0;
-    max = sizeof(xml_encoding_map)/sizeof(xml_encoding_map[0]) - 1;
+    max = ARRAY_SIZE(xml_encoding_map) - 1;
 
     while (min <= max)
     {
@@ -3013,12 +3013,12 @@ static void reader_get_attribute_ns_uri(xmlreader *reader, struct attribute *att
             strval_eq(reader, &attr->prefix, &strval_xmlns))
     {
         *uri = xmlns_uriW;
-        *len = sizeof(xmlns_uriW)/sizeof(xmlns_uriW[0]) - 1;
+        *len = ARRAY_SIZE(xmlns_uriW) - 1;
     }
     else if (strval_eq(reader, &attr->prefix, &strval_xml))
     {
         *uri = xml_uriW;
-        *len = sizeof(xml_uriW)/sizeof(xml_uriW[0]) - 1;
+        *len = ARRAY_SIZE(xml_uriW) - 1;
     }
     else
     {
diff --git a/dlls/xmllite/writer.c b/dlls/xmllite/writer.c
index 9bf7e63..88f75b6 100644
--- a/dlls/xmllite/writer.c
+++ b/dlls/xmllite/writer.c
@@ -37,8 +37,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(xmllite);
 /* not defined in public headers */
 DEFINE_GUID(IID_IXmlWriterOutput, 0xc1131708, 0x0f59, 0x477f, 0x93, 0x59, 0x7d, 0x33, 0x24, 0x51, 0xbc, 0x1a);
 
-#define ARRAY_SIZE(array) (sizeof(array)/sizeof((array)[0]))
-
 static const WCHAR closeelementW[] = {'<','/'};
 static const WCHAR closetagW[] = {' ','/','>'};
 static const WCHAR closepiW[] = {'?','>'};
diff --git a/dlls/xmllite/xmllite_private.h b/dlls/xmllite/xmllite_private.h
index 7884e27..381dec4 100644
--- a/dlls/xmllite/xmllite_private.h
+++ b/dlls/xmllite/xmllite_private.h
@@ -23,6 +23,8 @@
 
 #include "wine/heap.h"
 
+#define ARRAY_SIZE(array) (sizeof(array)/sizeof((array)[0]))
+
 static inline void *m_alloc(IMalloc *imalloc, size_t len)
 {
     if (imalloc)




More information about the wine-cvs mailing list