Re: xmllite: Use BOOL type where appropriate

2013-10-10 Thread Nikolay Sivov

On 10/10/2013 00:36, Frédéric Delanoy wrote:

---
  dlls/xmllite/reader.c | 16 
  1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlls/xmllite/reader.c b/dlls/xmllite/reader.c
index 0a4423c..a216951 100644
--- a/dlls/xmllite/reader.c
+++ b/dlls/xmllite/reader.c
@@ -726,7 +726,7 @@ static void readerinput_grow(xmlreaderinput *readerinput, 
int length)
  }
  }
  
-static inline int readerinput_is_utf8(xmlreaderinput *readerinput)

+static inline BOOL readerinput_is_utf8(xmlreaderinput *readerinput)
  {
  static char startA[] = {'','?'};
  static char commentA[] = {'','!'};
@@ -953,7 +953,7 @@ static void reader_skipn(xmlreader *reader, int n)
  }
  }
  
-static inline int is_wchar_space(WCHAR ch)

+static inline BOOL is_wchar_space(WCHAR ch)
  {
  return ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n';
  }
@@ -1055,7 +1055,7 @@ static HRESULT reader_parse_versioninfo(xmlreader *reader)
  }
  
  /* ([A-Za-z0-9._] | '-') */

-static inline int is_wchar_encname(WCHAR ch)
+static inline BOOL is_wchar_encname(WCHAR ch)
  {
  return ((ch = 'A'  ch = 'Z') ||
  (ch = 'a'  ch = 'z') ||
@@ -1269,7 +1269,7 @@ static HRESULT reader_parse_comment(xmlreader *reader)
  }
  
  /* [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x1-#x10] */

-static inline int is_char(WCHAR ch)
+static inline BOOL is_char(WCHAR ch)
  {
  return (ch == '\t') || (ch == '\r') || (ch == '\n') ||
 (ch = 0x20  ch = 0xd7ff) ||
@@ -1279,7 +1279,7 @@ static inline int is_char(WCHAR ch)
  }
  
  /* [13] PubidChar ::= #x20 | #xD | #xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] */

-static inline int is_pubchar(WCHAR ch)
+static inline BOOL is_pubchar(WCHAR ch)
  {
  return (ch == ' ') ||
 (ch = 'a'  ch = 'z') ||
@@ -1292,7 +1292,7 @@ static inline int is_pubchar(WCHAR ch)
 (ch == '_') || (ch == '\r') || (ch == '\n');
  }
  
-static inline int is_namestartchar(WCHAR ch)

+static inline BOOL is_namestartchar(WCHAR ch)
  {
  return (ch == ':') || (ch = 'A'  ch = 'Z') ||
 (ch == '_') || (ch = 'a'  ch = 'z') ||
@@ -1312,7 +1312,7 @@ static inline int is_namestartchar(WCHAR ch)
  }
  
  /* [4 NS] NCName ::= Name - (Char* ':' Char*) */

-static inline int is_ncnamechar(WCHAR ch)
+static inline BOOL is_ncnamechar(WCHAR ch)
  {
  return (ch = 'A'  ch = 'Z') ||
 (ch == '_') || (ch = 'a'  ch = 'z') ||
@@ -1336,7 +1336,7 @@ static inline int is_ncnamechar(WCHAR ch)
 (ch = 0xfdf0  ch = 0xfffd);
  }
  
-static inline int is_namechar(WCHAR ch)

+static inline BOOL is_namechar(WCHAR ch)
  {
  return (ch == ':') || is_ncnamechar(ch);
  }
I don't actually see what this will achieve, but I see such patches are 
accepted. Is it a new style rule?





Re: xmllite: Use BOOL type where appropriate

2013-10-10 Thread Frédéric Delanoy
On Thu, Oct 10, 2013 at 12:40 PM, Nikolay Sivov bungleh...@gmail.com wrote:
 On 10/10/2013 00:36, Frédéric Delanoy wrote:

 ---
   dlls/xmllite/reader.c | 16 
   1 file changed, 8 insertions(+), 8 deletions(-)

 diff --git a/dlls/xmllite/reader.c b/dlls/xmllite/reader.c
 index 0a4423c..a216951 100644
 --- a/dlls/xmllite/reader.c
 +++ b/dlls/xmllite/reader.c
 @@ -726,7 +726,7 @@ static void readerinput_grow(xmlreaderinput
 *readerinput, int length)
   }
   }
   -static inline int readerinput_is_utf8(xmlreaderinput *readerinput)
 +static inline BOOL readerinput_is_utf8(xmlreaderinput *readerinput)

 I don't actually see what this will achieve, but I see such patches are
 accepted. Is it a new style rule?

Basically cleanup/clarity. Using boolean values when expressing
logical expressions results does make sense (and it makes the intent
clearer) IMHO.
The fact that it translates to integer values is just a C
implementation/design detail.

Why using an integer type when one only needs one of two truth values
like TRUE/FALSE?

-- 
Frédéric Delanoy




Re: xmllite: Use BOOL type where appropriate

2013-10-10 Thread Henri Verbeet
On 10 October 2013 16:59, Frédéric Delanoy frederic.dela...@gmail.com wrote:
 Basically cleanup/clarity. Using boolean values when expressing
 logical expressions results does make sense (and it makes the intent
 clearer) IMHO.
I just think it would have been nice if we could have used the C99
bool type, but clearly C99 is much too new for any real compilers to
support.