Closed Bug 104523 Opened 23 years ago Closed 23 years ago

unnecessary calls to strlen in nsIOService::ParseFileURL

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX
Future

People

(Reporter: darin.moz, Assigned: alecf)

References

Details

(Keywords: helpwanted)

was just looking at the uses of nsIURLParser today, and noticed the following:

the strlen calls at the end of nsLocalFile::ParseURL are unnecessary, and can be
replaced by simply checking for a \0 byte in the first element of each string.

    // If any of the components are non-NULL but empty, free them
    if (*outHost && !nsCRT::strlen(*outHost))
        CRTFREEIF(*outHost);
    if (*outDirectory && !nsCRT::strlen(*outDirectory))
        CRTFREEIF(*outDirectory);
    if (*outFileBaseName && !nsCRT::strlen(*outFileBaseName))
        CRTFREEIF(*outFileBaseName);
    if (*outFileExtension && !nsCRT::strlen(*outFileExtension))
        CRTFREEIF(*outFileExtension);

eg.

    if (*outFileExtension && !**outFileExtension)

also, there is no need to call CRTFREEIF... the IF isn't necessary here.  why
don't we have a CRTFREE?
conrad, alec, maybe you can look at this?  
Keywords: helpwanted
Target Milestone: --- → Future
While I agree this is nasty, we're eventually getting rid of ParseURL from
nsLocalFile, so there is no necko dependency in xpcom. I'm marking this a
dependency of bug 100212, but I think that if we fix 100212 correctly, this bug
will automagically go away. But I'm leaving open just to be sure, 
Assignee: dougt → alecf
Depends on: 100212
ok, I ended up moving ParseURL into nsIOService as ParseFileURL.. updating summary
Status: NEW → ASSIGNED
Summary: unnecessary calls to strlen in nsLocalFile::ParseURL → unnecessary calls to strlen in nsIOService::ParseFileURL
ok, so it looks like the code in question is gone, with darin's url parsing
optimizations a few weeks (months?) ago.. nothing to do now
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.