kernel32: Clean up PROFILE_isspaceW

Michael Karcher wine at mkarcher.dialup.fu-berlin.de
Sun Sep 14 09:40:07 CDT 2008


isspaceW already handles '\r' as space character, no need to check that.
isspaceW also handles '\n' as space character, so the test in PROFILE_Load
is redundant.
---
 dlls/kernel32/profile.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/dlls/kernel32/profile.c b/dlls/kernel32/profile.c
index 22d4cb5..ab26533 100644
--- a/dlls/kernel32/profile.c
+++ b/dlls/kernel32/profile.c
@@ -272,10 +272,8 @@ static void PROFILE_Free( PROFILESECTION *section )
 /* returns 1 if a character white space else 0 */
 static inline int PROFILE_isspaceW(WCHAR c)
 {
-	if (isspaceW(c)) return 1;
-	if (c=='\r' || c==0x1a) return 1;
-	/* CR and ^Z (DOS EOF) are spaces too  (found on CD-ROMs) */
-	return 0;
+	/* ^Z (DOS EOF) is a space too  (found on CD-ROMs) */
+	return isspaceW(c) || c == 0x1a;
 }
 
 static inline ENCODING PROFILE_DetectTextEncoding(const void * buffer, int * len)
@@ -415,7 +413,7 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
 
         /* get rid of white space */
         while (szLineStart < szLineEnd && PROFILE_isspaceW(*szLineStart)) szLineStart++;
-        while ((szLineEnd > szLineStart) && ((szLineEnd[-1] == '\n') || PROFILE_isspaceW(szLineEnd[-1]))) szLineEnd--;
+        while ((szLineEnd > szLineStart) && PROFILE_isspaceW(szLineEnd[-1])) szLineEnd--;
 
         if (szLineStart >= szLineEnd) continue;
 
-- 
1.5.5.4




More information about the wine-patches mailing list