unnecessary calls to strlen in nsIOService::ParseFileURL

RESOLVED WONTFIX

Status

()

Core
XPCOM
RESOLVED WONTFIX
17 years ago
17 years ago

People

(Reporter: Darin Fisher, Assigned: Alec Flett)

Tracking

({helpwanted})

Trunk
Future
helpwanted
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

17 years ago
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?

Comment 1

17 years ago
conrad, alec, maybe you can look at this?  
Keywords: helpwanted
Target Milestone: --- → Future
(Assignee)

Comment 2

17 years ago
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
(Assignee)

Comment 3

17 years ago
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
(Assignee)

Comment 4

17 years ago
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
Last Resolved: 17 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.