Mike Mattie (via RT) wrote:
While mucking around in src/library.c I noticed some cut & paste duplication. 
It looked like a fairly simple hoist so I have attached the changes I made.

I do not have a win32 platform available for testing so I haven't been able to 
compile test it.

    while ( (cnv = strchr(path->strstart, '/')) )
        *cnv = '\\';

this looks totally broken. unless path->strstart is a stateful iterator this 
will only convert the first instance of a '/' character.
Nope, it works fine. The first time you call strchr it finds the first /, but by the second time you run it that has been transformed to a \ so it finds the "second" / (now the first one), and so forth.

I think in the long run we'll want to provide a more generic way to transform paths to the way the current platform likes them, but in the meantime I'm very much up for reducing copy and paste code; I'll apply this tonight if no other Win32ers beat me to it. :-)

Thanks,

Jonathan

Reply via email to