[syslinux] [PATCH] chrreplace: Don't skip the first character

Josh Triplett josh at joshtriplett.org
Sat May 16 00:30:06 PDT 2015


Check if the first character matches the character to replace, rather
than skipping it and starting with the second.

Signed-off-by: Josh Triplett <josh at joshtriplett.org>
---

I'm assuming, based on a look at the callers, that this is not
intentional, and that it just happened that none of the callers happened
to ever need to replace the first character.

 com32/lib/chrreplace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/com32/lib/chrreplace.c b/com32/lib/chrreplace.c
index 65786f9..cfbf5d4 100644
--- a/com32/lib/chrreplace.c
+++ b/com32/lib/chrreplace.c
@@ -4,8 +4,8 @@
 void chrreplace(char *source, char old, char new) 
 {
     while (*source) { 
-	source++;
 	if (source[0] == old) source[0]=new;
+	source++;
     }
 }
 
-- 
2.1.4



More information about the Syslinux mailing list