string_remove_all_chars - only write if the character is not the

one to remove
This commit is contained in:
libretroadmin 2025-07-20 03:14:20 +02:00
parent 02f3f31121
commit 954d202637
1 changed files with 4 additions and 3 deletions

View File

@ -495,9 +495,10 @@ void string_remove_all_chars(char *s, char c)
while (*read_ptr != '\0')
{
*write_ptr = *read_ptr++;
if (*write_ptr != c)
write_ptr++;
/* Only write if the character is not the one to remove */
if (*read_ptr != c)
*write_ptr++ = *read_ptr;
read_ptr++;
}
*write_ptr = '\0';