Author: cfinck
Date: Sat Apr 19 18:57:44 2008
New Revision: 33042
URL:
http://svn.reactos.org/svn/reactos?rev=33042&view=rev
Log:
Idx already contains the length of the string
Just loop and remove all newline & line feed characters from the right instead of
doing this with 8 strlen calls
Modified:
trunk/reactos/boot/freeldr/freeldr/inifile/parse.c
Modified: trunk/reactos/boot/freeldr/freeldr/inifile/parse.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/inifi…
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/inifile/parse.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/inifile/parse.c [iso-8859-1] Sat Apr 19 18:57:44
2008
@@ -232,10 +232,8 @@
Buffer[Idx] = '\0';
// Get rid of newline & linefeed characters (if any)
- if(strlen(Buffer) && ((Buffer[strlen(Buffer)-1] == '\n') ||
(Buffer[strlen(Buffer)-1] == '\r')))
- Buffer[strlen(Buffer)-1] = '\0';
- if(strlen(Buffer) && ((Buffer[strlen(Buffer)-1] == '\n') ||
(Buffer[strlen(Buffer)-1] == '\r')))
- Buffer[strlen(Buffer)-1] = '\0';
+ while(Idx && (Buffer[--Idx] == '\n' || Buffer[Idx] == '\r'))
+ Buffer[Idx] = '\0';
// Send back new offset
return CurrentOffset;