diff --git a/trace.c b/trace.c index 74a05b44..44d3bde5 100644 --- a/trace.c +++ b/trace.c @@ -191,15 +191,11 @@ static int strrepc(char *pszStr, char cFrom, char cTo) /*----------------------------------------------------------------*/ - while( 0 != ( ptr = strchr( pszStr, cFrom ) ) ) - - { /* WHILE cFrom occurs in pszStr */ - - pszStr[ (int) ptr - (int) pszStr ] = cTo ; - - /*- Replace next cFrom with cTo */ - - iReturn++ ; /*- count */ + for (ptr = pszStr; ptr && *ptr; ++ptr) { + if (*ptr == cFrom) { + *ptr = cTo; + ++iReturn; + } } return( iReturn ) ;